-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patrick Meade
committed
Jul 24, 2024
1 parent
a84560b
commit adca8a7
Showing
6 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Ignore the target directory where Cargo builds your project | ||
target | ||
|
||
# Ignore any files related to version control | ||
.git | ||
.gitignore | ||
|
||
# Ignore build artifacts | ||
**/*.rs.bk | ||
|
||
# Ignore IDE and editor directories and files | ||
.idea | ||
.vscode | ||
*.iml | ||
|
||
# Ignore temporary files | ||
*.swp | ||
*.tmp | ||
*.temp | ||
*.bak | ||
*.old | ||
*.log | ||
|
||
# Ignore node_modules (if you have any Node.js dependencies) | ||
node_modules | ||
|
||
# Ignore Docker-related files (if you don't want them in your image) | ||
.dockerignore | ||
Dockerfile | ||
|
||
# Ignore any other local configuration files | ||
*.local | ||
|
||
# Ignore any potential secrets or sensitive files | ||
.env | ||
*.secret | ||
*.key | ||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
publish: | ||
name: "Publish Docker Image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Meta | ||
id: docker_meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
ghcr.io/wipacrepo/wipac-disk-tracking | ||
tag-sha: true | ||
tag-semver: | | ||
{{major}} | ||
{{major}}.{{minor}} | ||
{{major}}.{{minor}}.{{patch}} | ||
tags: | | ||
type=ref,event=branch,branch=main,tag=main | ||
type=ref,event=branch,branch=main,tag=latest | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish Docker Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Dockerfile | ||
|
||
#---------------------------------------------------------------------------- | ||
# Build the application | ||
#---------------------------------------------------------------------------- | ||
FROM rust:slim-bookworm AS build | ||
|
||
COPY Cargo.lock Cargo.toml /build/ | ||
COPY src /build/src | ||
|
||
WORKDIR /build | ||
RUN cargo build --release | ||
|
||
#---------------------------------------------------------------------------- | ||
# Create the application image | ||
#---------------------------------------------------------------------------- | ||
FROM debian:bookworm-slim AS image | ||
|
||
COPY README.md / | ||
COPY --from=build /build/target/release/wipac-disk-tracking /app/ | ||
|
||
RUN useradd -m -U app | ||
USER app | ||
|
||
WORKDIR /app | ||
CMD [ "/app/wipac-disk-tracking" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# build-docker | ||
|
||
docker buildx build \ | ||
--file Dockerfile \ | ||
--tag wipac-disk-tracking:latest-SNAPSHOT \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
# run-docker | ||
|
||
docker run \ | ||
--detach \ | ||
--env=RUST_LOG=debug \ | ||
--name=wipac_disk_tracking \ | ||
--publish 8080:8080 \ | ||
--rm \ | ||
wipac-disk-tracking:latest-SNAPSHOT |