Skip to content

Commit

Permalink
Add OCI standard labels to Dockerfile for image tracking
Browse files Browse the repository at this point in the history
Add build arguments and labels for commit hash and repo URL to enable better traceability of deployed images.
  • Loading branch information
HauwaHakimi committed Nov 26, 2024
1 parent 70d9ffb commit 91d0587
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ RUN bundle config set --local without 'development test' \
# copy required files from base images, precompile assets & cleanup
FROM ruby:3.3.5-alpine

# Build arguments for image metadata
ARG COMMIT_HASH
ARG REPO_URL

# Add OCI standard labels for image tracking and metadata
LABEL org.opencontainers.image.revision=$COMMIT_HASH \
org.opencontainers.image.source=$REPO_URL

WORKDIR /opt/app
COPY --from=rubybuilder /usr/local/bundle /usr/local/bundle
COPY --from=nodebuilder /usr/local/bin /usr/local/nodebin
Expand Down

0 comments on commit 91d0587

Please sign in to comment.