Skip to content

Commit

Permalink
github sha pass to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmanczak committed Jul 14, 2024
1 parent 449fce2 commit a4806ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/target
.DS_Store
.git
.gitignore
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build -t rustapi .
run: docker build -t rustapi --build-arg GITHUB_SHA=${{ github.sha }} .
- name: Run image
run: |
docker stop rustapi || true
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::process::Command;

fn main() {
println!("cargo:rustc-env=GIT_HASH={}", "");
match Command::new("echo").args(&["$GITHUB_SHA"]).output() {
match Command::new("git").args(&["rev-parse", "HEAD"]).output() {
Ok(output) => match String::from_utf8(output.stdout) {
Ok(hash) => println!("cargo:rustc-env=GIT_HASH={}", hash),
Err(_) => (),
Expand Down

0 comments on commit a4806ce

Please sign in to comment.