Skip to content

Commit

Permalink
Embed git rev-parse in docker metadata labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jdye64 committed Feb 12, 2025
1 parent 3c68091 commit 6c39d36
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# Build the Docker image using the Dockerfile
- name: Build Docker image
run: |
docker build --target runtime -t nv-ingest:latest .
docker build --target runtime --build-arg GIT_COMMIT=${GITHUB_SHA} -t nv-ingest:latest .
- name: Run Pytest inside Docker container
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-nightly-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# Build the Docker image using the Dockerfile
- name: Build Docker image
run: |
docker build --target runtime -t ${{ secrets.DOCKER_REGISTRY }}/nv-ingest:${{ env.CURRENT_DATE }} .
docker build --target runtime --build-arg GIT_COMMIT=${GITHUB_SHA} -t ${{ secrets.DOCKER_REGISTRY }}/nv-ingest:${{ env.CURRENT_DATE }} .
# Login to NGC
- name: Log in to NGC Registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# Build the Docker image using the Dockerfile
- name: Build Docker image
run: |
docker build --target runtime -t ${{ secrets.DOCKER_REGISTRY }}/nv-ingest:${{ env.SHORT_BRANCH_NAME }} .
docker build --target runtime --build-arg GIT_COMMIT=${GITHUB_SHA} -t ${{ secrets.DOCKER_REGISTRY }}/nv-ingest:${{ env.SHORT_BRANCH_NAME }} .
# Login to NGC
- name: Log in to NGC Registry
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ ARG RELEASE_TYPE="dev"
ARG VERSION=""
ARG VERSION_REV="0"

# Embed the `git rev-parse HEAD` as a Docker metadata label
# Allows for linking container builds to git commits
# docker inspect nv-ingest:latest | jq '.[0].Config.Labels.git_commit' -> GIT_SHA
ARG GIT_COMMIT
LABEL git_commit=$GIT_COMMIT

# Install necessary dependencies using apt-get
RUN apt-get update && apt-get install -y \
wget \
Expand Down

0 comments on commit 6c39d36

Please sign in to comment.