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