Skip to content

Commit 2ce593b

Browse files
chore: Optimize Docker image layers (#21525)
Signed-off-by: Marco Franssen <[email protected]>
1 parent 83257a9 commit 2ce593b

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

Diff for: Dockerfile

+16-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ARG BASE_IMAGE=docker.io/library/ubuntu:24.04@sha256:80dd3c3b9c6cecb9f1667e9290b
66
####################################################################################################
77
FROM docker.io/library/golang:1.24.1@sha256:c5adecdb7b3f8c5ca3c88648a861882849cc8b02fed68ece31e25de88ad13418 AS builder
88

9+
WORKDIR /tmp
10+
911
RUN echo 'deb http://archive.debian.org/debian buster-backports main' >> /etc/apt/sources.list
1012

1113
RUN apt-get update && apt-get install --no-install-recommends -y \
@@ -23,8 +25,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
2325
apt-get clean && \
2426
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2527

26-
WORKDIR /tmp
27-
2828
COPY hack/install.sh hack/tool-versions.sh ./
2929
COPY hack/installers installers
3030

@@ -40,8 +40,8 @@ LABEL org.opencontainers.image.source="https://github.com/argoproj/argo-cd"
4040

4141
USER root
4242

43-
ENV ARGOCD_USER_ID=999
44-
ENV DEBIAN_FRONTEND=noninteractive
43+
ENV ARGOCD_USER_ID=999 \
44+
DEBIAN_FRONTEND=noninteractive
4545

4646
RUN groupadd -g $ARGOCD_USER_ID argocd && \
4747
useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
@@ -55,11 +55,13 @@ RUN groupadd -g $ARGOCD_USER_ID argocd && \
5555
apt-get clean && \
5656
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
5757

58-
COPY hack/gpg-wrapper.sh /usr/local/bin/gpg-wrapper.sh
59-
COPY hack/git-verify-wrapper.sh /usr/local/bin/git-verify-wrapper.sh
58+
COPY hack/gpg-wrapper.sh \
59+
hack/git-verify-wrapper.sh \
60+
entrypoint.sh \
61+
/usr/local/bin/
6062
COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
6163
COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/kustomize
62-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
64+
6365
# keep uid_entrypoint.sh for backward compatibility
6466
RUN ln -s /usr/local/bin/entrypoint.sh /usr/local/bin/uid_entrypoint.sh
6567

@@ -111,13 +113,13 @@ RUN go mod download
111113
# Perform the build
112114
COPY . .
113115
COPY --from=argocd-ui /src/dist/app /go/src/github.com/argoproj/argo-cd/ui/dist/app
114-
ARG TARGETOS
115-
ARG TARGETARCH
116+
ARG TARGETOS \
117+
TARGETARCH
116118
# These build args are optional; if not specified the defaults will be taken from the Makefile
117-
ARG GIT_TAG
118-
ARG BUILD_DATE
119-
ARG GIT_TREE_STATE
120-
ARG GIT_COMMIT
119+
ARG GIT_TAG \
120+
BUILD_DATE \
121+
GIT_TREE_STATE \
122+
GIT_COMMIT
121123
RUN GIT_COMMIT=$GIT_COMMIT \
122124
GIT_TREE_STATE=$GIT_TREE_STATE \
123125
GIT_TAG=$GIT_TAG \
@@ -130,6 +132,7 @@ RUN GIT_COMMIT=$GIT_COMMIT \
130132
# Final image
131133
####################################################################################################
132134
FROM argocd-base
135+
ENTRYPOINT ["/usr/bin/tini", "--"]
133136
COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/local/bin/
134137

135138
USER root
@@ -144,4 +147,3 @@ RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
144147
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-commit-server
145148

146149
USER $ARGOCD_USER_ID
147-
ENTRYPOINT ["/usr/bin/tini", "--"]

0 commit comments

Comments
 (0)