github.com/argoproj/argo-cd@v1.8.7/Dockerfile (about)

     1  ARG BASE_IMAGE=debian:10-slim
     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 golang:1.14.12 as builder
     8  
     9  RUN echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
    10  
    11  RUN apt-get update && apt-get install -y \
    12      openssh-server \
    13      nginx \
    14      fcgiwrap \
    15      git \
    16      git-lfs \
    17      make \
    18      wget \
    19      gcc \
    20      zip && \
    21      apt-get clean && \
    22      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    23  
    24  WORKDIR /tmp
    25  
    26  ADD hack/install.sh .
    27  ADD hack/installers installers
    28  ADD hack/tool-versions.sh .
    29  
    30  RUN ./install.sh packr-linux
    31  RUN ./install.sh kubectl-linux
    32  RUN ./install.sh ksonnet-linux
    33  RUN ./install.sh helm2-linux
    34  RUN ./install.sh helm-linux
    35  RUN ./install.sh kustomize-linux
    36  
    37  ####################################################################################################
    38  # Argo CD Base - used as the base for both the release and dev argocd images
    39  ####################################################################################################
    40  FROM $BASE_IMAGE as argocd-base
    41  
    42  USER root
    43  
    44  RUN echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
    45  
    46  RUN groupadd -g 999 argocd && \
    47      useradd -r -u 999 -g argocd argocd && \
    48      mkdir -p /home/argocd && \
    49      chown argocd:0 /home/argocd && \
    50      chmod g=u /home/argocd && \
    51      chmod g=u /etc/passwd && \
    52      apt-get update && \
    53      apt-get install -y git git-lfs python3-pip tini gpg && \
    54      apt-get clean && \
    55      pip3 install awscli==1.18.80 && \
    56      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    57  
    58  COPY hack/git-ask-pass.sh /usr/local/bin/git-ask-pass.sh
    59  COPY hack/gpg-wrapper.sh /usr/local/bin/gpg-wrapper.sh
    60  COPY hack/git-verify-wrapper.sh /usr/local/bin/git-verify-wrapper.sh
    61  COPY --from=builder /usr/local/bin/ks /usr/local/bin/ks
    62  COPY --from=builder /usr/local/bin/helm2 /usr/local/bin/helm2
    63  COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
    64  COPY --from=builder /usr/local/bin/kubectl /usr/local/bin/kubectl
    65  COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/kustomize
    66  # script to add current (possibly arbitrary) user to /etc/passwd at runtime
    67  # (if it's not already there, to be openshift friendly)
    68  COPY uid_entrypoint.sh /usr/local/bin/uid_entrypoint.sh
    69  
    70  # support for mounting configuration from a configmap
    71  RUN mkdir -p /app/config/ssh && \
    72      touch /app/config/ssh/ssh_known_hosts && \
    73      ln -s /app/config/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts 
    74  
    75  RUN mkdir -p /app/config/tls
    76  RUN mkdir -p /app/config/gpg/source && \
    77      mkdir -p /app/config/gpg/keys && \
    78      chown argocd /app/config/gpg/keys && \
    79      chmod 0700 /app/config/gpg/keys
    80  
    81  # workaround ksonnet issue https://github.com/ksonnet/ksonnet/issues/298
    82  ENV USER=argocd
    83  
    84  USER 999
    85  WORKDIR /home/argocd
    86  
    87  ####################################################################################################
    88  # Argo CD UI stage
    89  ####################################################################################################
    90  FROM node:12.18.4 as argocd-ui
    91  
    92  WORKDIR /src
    93  ADD ["ui/package.json", "ui/yarn.lock", "./"]
    94  
    95  RUN yarn install
    96  
    97  ADD ["ui/", "."]
    98  
    99  ARG ARGO_VERSION=latest
   100  ENV ARGO_VERSION=$ARGO_VERSION
   101  RUN NODE_ENV='production' yarn build
   102  
   103  ####################################################################################################
   104  # Argo CD Build stage which performs the actual build of Argo CD binaries
   105  ####################################################################################################
   106  FROM golang:1.14.12 as argocd-build
   107  
   108  COPY --from=builder /usr/local/bin/packr /usr/local/bin/packr
   109  
   110  WORKDIR /go/src/github.com/argoproj/argo-cd
   111  
   112  COPY go.mod go.mod
   113  COPY go.sum go.sum
   114  
   115  RUN go mod download
   116  
   117  # Perform the build
   118  COPY . .
   119  RUN make cli-local server controller repo-server argocd-util
   120  
   121  ARG BUILD_ALL_CLIS=true
   122  RUN if [ "$BUILD_ALL_CLIS" = "true" ] ; then \
   123      make CLI_NAME=argocd-darwin-amd64 GOOS=darwin cli-local && \
   124      make CLI_NAME=argocd-windows-amd64.exe GOOS=windows cli-local \
   125      ; fi
   126  
   127  ####################################################################################################
   128  # Final image
   129  ####################################################################################################
   130  FROM argocd-base
   131  COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/local/bin/
   132  COPY --from=argocd-ui ./src/dist/app /shared/app