Skip to content

Commit

Permalink
MGMT-19819: Add the commit reference from which the image is built to…
Browse files Browse the repository at this point in the history
… the image (#914)
  • Loading branch information
danmanor authored Feb 19, 2025
1 parent 8266f88 commit 3e2184b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile.assisted_installer_agent
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ COPY --chown=1001 . .

RUN TARGETPLATFORM=$TARGETPLATFORM make build-release

# Extract the commit reference from which the image is built
USER 0

RUN git config --global --add safe.directory '*' && \
git rev-parse --short HEAD > /commit-reference.txt

FROM quay.io/centos/centos:stream9
ARG TARGETPLATFORM

Expand Down Expand Up @@ -45,6 +51,10 @@ RUN if [[ "$TARGETPLATFORM" == "linux/amd64" || -z "$TARGETPLATFORM" ]] ; then d
# Remove RPM/DNF files to reduce image size
&& rm -rf /var/lib/rpm/rpmdb.sqlite /var/lib/dnf


# Copy the commit reference from the builder
COPY --from=builder /commit-reference.txt /commit-reference.txt

COPY --from=builder /opt/app-root/src/build/agent /usr/bin/agent

# The step binaries are all symlinks to /usr/bin/agent
Expand Down

0 comments on commit 3e2184b

Please sign in to comment.