-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (40 loc) · 1.62 KB
/
Dockerfile
File metadata and controls
42 lines (40 loc) · 1.62 KB
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
FROM google-go.pkg.dev/golang:1.24.13@sha256:2ea380febc64f22355a66fd6141eb6575276b3ec45c97c1594f657bc47b60e60 AS gobase
WORKDIR /app
COPY . ./
RUN mkdir /etc/alertmanager
RUN mkdir /alertmanager
ENV GOEXPERIMENT=boringcrypto
ENV CGO_ENABLED=1
ENV GOFIPS140=off
ENV GOTOOLCHAIN=local
ENV GOARCH=${TARGETARCH}
ENV GOOS=${TARGETOS}
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
apt install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross; \
CC=aarch64-linux-gnu-gcc; \
fi && \
go build \
-mod=vendor \
-ldflags="-X github.com/prometheus/common/version.Version=$(cat VERSION) \
-X github.com/prometheus/common/version.BuildDate=$(date --iso-8601=seconds)" \
./cmd/alertmanager && \
go build \
-mod=vendor \
-ldflags="-X github.com/prometheus/common/version.Version=$(cat VERSION) \
-X github.com/prometheus/common/version.BuildDate=$(date --iso-8601=seconds)" \
./cmd/amtool
FROM gke.gcr.io/gke-distroless/libc:gke_distroless_20260107.00_p0@sha256:76d0dfed4a2148e2c5d2f2c3aae5fc4f2f2ab9ccd842994359ee982a24cb22de
COPY --from=gobase /app/alertmanager /bin/alertmanager
COPY --from=gobase /app/amtool /bin/amtool
COPY --from=gobase --chown=nobody:nobody /etc/alertmanager /etc/alertmanager
COPY --from=gobase --chown=nobody:nobody /alertmanager /alertmanager
COPY LICENSE LICENSE
COPY NOTICE NOTICE
USER nobody
EXPOSE 9093
VOLUME [ "/alertmanager" ]
WORKDIR /alertmanager
ENTRYPOINT [ "/bin/alertmanager" ]
CMD [ "--config.file=/etc/alertmanager/alertmanager.yml", \
"--storage.path=/alertmanager" ]