github.com/argoproj/argo-cd/v2@v2.10.9/Dockerfile (about)

     1  ARG BASE_IMAGE=docker.io/library/ubuntu:22.04@sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508
     2  ####################################################################################################
     3  # Builder image
     4  # Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
     5  # Also used as the image in CI jobs so needs all dependencies
     6  ####################################################################################################
     7  FROM docker.io/library/golang:1.21.3@sha256:02d7116222536a5cf0fcf631f90b507758b669648e0f20186d2dc94a9b419a9b AS builder
     8  
     9  RUN echo 'deb http://archive.debian.org/debian buster-backports main' >> /etc/apt/sources.list
    10  
    11  RUN apt-get update && apt-get install --no-install-recommends -y \
    12      openssh-server \
    13      nginx \
    14      unzip \
    15      fcgiwrap \
    16      git \
    17      git-lfs \
    18      make \
    19      wget \
    20      gcc \
    21      sudo \
    22      zip && \
    23      apt-get clean && \
    24      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    25  
    26  WORKDIR /tmp
    27  
    28  COPY hack/install.sh hack/tool-versions.sh ./
    29  COPY hack/installers installers
    30  
    31  RUN ./install.sh helm-linux && \
    32      INSTALL_PATH=/usr/local/bin ./install.sh kustomize
    33  
    34  ####################################################################################################
    35  # Argo CD Base - used as the base for both the release and dev argocd images
    36  ####################################################################################################
    37  FROM $BASE_IMAGE AS argocd-base
    38  
    39  LABEL org.opencontainers.image.source="https://github.com/argoproj/argo-cd"
    40  
    41  USER root
    42  
    43  ENV ARGOCD_USER_ID=999
    44  ENV DEBIAN_FRONTEND=noninteractive
    45  
    46  RUN groupadd -g $ARGOCD_USER_ID argocd && \
    47      useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
    48      mkdir -p /home/argocd && \
    49      chown argocd:0 /home/argocd && \
    50      chmod g=u /home/argocd && \
    51      apt-get update && \
    52      apt-get dist-upgrade -y && \
    53      apt-get install -y \
    54      git git-lfs tini gpg tzdata && \
    55      apt-get clean && \
    56      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    57  
    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
    60  COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
    61  COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/kustomize
    62  COPY entrypoint.sh /usr/local/bin/entrypoint.sh
    63  # keep uid_entrypoint.sh for backward compatibility
    64  RUN ln -s /usr/local/bin/entrypoint.sh /usr/local/bin/uid_entrypoint.sh
    65  
    66  # support for mounting configuration from a configmap
    67  WORKDIR /app/config/ssh
    68  RUN touch ssh_known_hosts && \
    69      ln -s /app/config/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts
    70  
    71  WORKDIR /app/config
    72  RUN mkdir -p tls && \
    73      mkdir -p gpg/source && \
    74      mkdir -p gpg/keys && \
    75      chown argocd gpg/keys && \
    76      chmod 0700 gpg/keys
    77  
    78  ENV USER=argocd
    79  
    80  USER $ARGOCD_USER_ID
    81  WORKDIR /home/argocd
    82  
    83  ####################################################################################################
    84  # Argo CD UI stage
    85  ####################################################################################################
    86  FROM --platform=$BUILDPLATFORM docker.io/library/node:20.6.1@sha256:14bd39208dbc0eb171cbfb26ccb9ac09fa1b2eba04ccd528ab5d12983fd9ee24 AS argocd-ui
    87  
    88  WORKDIR /src
    89  COPY ["ui/package.json", "ui/yarn.lock", "./"]
    90  
    91  RUN yarn install --network-timeout 200000 && \
    92      yarn cache clean
    93  
    94  COPY ["ui/", "."]
    95  
    96  ARG ARGO_VERSION=latest
    97  ENV ARGO_VERSION=$ARGO_VERSION
    98  ARG TARGETARCH
    99  RUN HOST_ARCH=$TARGETARCH NODE_ENV='production' NODE_ONLINE_ENV='online' NODE_OPTIONS=--max_old_space_size=8192 yarn build
   100  
   101  ####################################################################################################
   102  # Argo CD Build stage which performs the actual build of Argo CD binaries
   103  ####################################################################################################
   104  FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.21.3@sha256:02d7116222536a5cf0fcf631f90b507758b669648e0f20186d2dc94a9b419a9b AS argocd-build
   105  
   106  WORKDIR /go/src/github.com/argoproj/argo-cd
   107  
   108  COPY go.* ./
   109  RUN go mod download
   110  
   111  # Perform the build
   112  COPY . .
   113  COPY --from=argocd-ui /src/dist/app /go/src/github.com/argoproj/argo-cd/ui/dist/app
   114  ARG TARGETOS
   115  ARG TARGETARCH
   116  # 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
   121  RUN GIT_COMMIT=$GIT_COMMIT \
   122      GIT_TREE_STATE=$GIT_TREE_STATE \
   123      GIT_TAG=$GIT_TAG \
   124      BUILD_DATE=$BUILD_DATE \
   125      GOOS=$TARGETOS \
   126      GOARCH=$TARGETARCH \
   127      make argocd-all
   128  
   129  ####################################################################################################
   130  # Final image
   131  ####################################################################################################
   132  FROM argocd-base
   133  COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/local/bin/
   134  
   135  USER root
   136  RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
   137      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \
   138      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-cmp-server && \
   139      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller && \
   140      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \
   141      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-notifications && \
   142      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-applicationset-controller && \
   143      ln -s /usr/local/bin/argocd /usr/local/bin/argocd-k8s-auth
   144  
   145  USER $ARGOCD_USER_ID
   146  ENTRYPOINT ["/usr/bin/tini", "--"]