forked from parca-dev/parca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (41 loc) · 2.17 KB
/
Dockerfile
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# https://github.com/hadolint/hadolint/issues/861
# hadolint ignore=DL3029
FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/busybox:1.36.1@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79 as builder
RUN mkdir /.cache && touch -t 202101010000.00 /.cache
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG TARGETVARIANT=v1
# renovate: datasource=github-releases depName=grpc-ecosystem/grpc-health-probe
ARG GRPC_HEALTH_PROBE_VERSION=v0.4.21
# Downloading grpc_health_probe from github releases with retry as we have seen it fail a lot on ci.
RUN for i in `seq 1 50`; do \
wget -qO/bin/grpc_health_probe "https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-${TARGETOS}-${TARGETARCH}" && \
chmod +x /bin/grpc_health_probe && \
break; \
echo "Failed to download grpc_health_probe on $i th attempt, retrying in 5s..." \
sleep 5; \
done
WORKDIR /app
COPY dist dist
# NOTICE: See goreleaser.yml for the build paths.
RUN if [ "${TARGETARCH}" = 'amd64' ]; then \
cp "dist/parca_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT:-v1}/parca" . ; \
elif [ "${TARGETARCH}" = 'arm' ]; then \
cp "dist/parca_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT##v}/parca" . ; \
else \
cp "dist/parca_${TARGETOS}_${TARGETARCH}/parca" . ; \
fi
RUN chmod +x parca
# https://github.com/hadolint/hadolint/issues/861
# hadolint ignore=DL3029
FROM --platform="${TARGETPLATFORM:-linux/amd64}" docker.io/alpine:3.18.4@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 AS runner
LABEL \
org.opencontainers.image.source="https://github.com/parca-dev/parca" \
org.opencontainers.image.url="https://github.com/parca-dev/parca" \
org.opencontainers.image.description="Continuous profiling for analysis of CPU and memory usage, down to the line number and throughout time. Saving infrastructure cost, improving performance, and increasing reliability." \
org.opencontainers.image.licenses="Apache-2.0"
USER nobody
COPY --chown=0:0 --from=builder /bin/grpc_health_probe /
COPY --chown=0:0 --from=builder /app/parca /parca
COPY --chown=0:0 parca.yaml /parca.yaml
CMD ["/parca"]