diff --git a/Dockerfile b/Dockerfile index da6610a71..7c4982ec1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,23 @@ -ARG IMAGE_BUILD_GO=golang:1.20-bullseye -ARG IMAGE_BASE=gcr.io/distroless/static-debian11 +ARG IMAGE_BUILD_GO=google-go.pkg.dev/golang:1.20.14@sha256:6f86d8a81ff191bee8d3ff8b4c193889560b4ca15df373d5084953c5c860190f +ARG IMAGE_BASE=gke.gcr.io/gke-distroless/libc@sha256:4f834e207f2721977094aeec4c9daee7032c5daec2083c0be97760f4306e4f88 FROM ${IMAGE_BUILD_GO} AS gobase WORKDIR /app COPY . ./ -RUN make build +RUN mkdir /etc/alertmanager +RUN mkdir /alertmanager +RUN CGO_ENABLED=1 GOEXPERIMENT=boringcrypto \ + go build \ + -tags boring \ + -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 FROM ${IMAGE_BASE} 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 diff --git a/cmd/alertmanager/boring.go b/cmd/alertmanager/boring.go new file mode 100644 index 000000000..991d18711 --- /dev/null +++ b/cmd/alertmanager/boring.go @@ -0,0 +1,21 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build boring + +package main + +import ( + _ "crypto/tls/fipsonly" +)