github.com/thanos-io/thanos@v0.32.5/Dockerfile.multi-stage (about)

     1  # By default we pin to amd64 sha. Use make docker to automatically adjust for arm64 versions.
     2  ARG BASE_DOCKER_SHA="14d68ca3d69fceaa6224250c83d81d935c053fb13594c811038c461194599973"
     3  FROM golang:1.21-alpine3.18 as builder
     4  
     5  WORKDIR $GOPATH/src/github.com/thanos-io/thanos
     6  # Change in the docker context invalidates the cache so to leverage docker
     7  # layer caching, moving update and installing apk packages above COPY cmd
     8  # More info https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache
     9  RUN apk update && apk add --no-cache alpine-sdk
    10  # Replaced ADD with COPY as add is generally to download content form link or tar files
    11  # while COPY supports the basic copying of local files into the container.
    12  # https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy
    13  COPY . $GOPATH/src/github.com/thanos-io/thanos
    14  
    15  RUN git update-index --refresh; make build
    16  
    17  # -----------------------------------------------------------------------------
    18  
    19  FROM quay.io/prometheus/busybox@sha256:${BASE_DOCKER_SHA}
    20  LABEL maintainer="The Thanos Authors"
    21  
    22  COPY --from=builder /go/bin/thanos /bin/thanos
    23  
    24  RUN adduser \
    25      -D `#Dont assign a password` \
    26      -H `#Dont create home directory` \
    27      -u 1001 `#User id`\
    28      thanos && \
    29      chown thanos /bin/thanos
    30  USER 1001
    31  ENTRYPOINT [ "/bin/thanos" ]