2023-09-15 16:26:38 +00:00
|
|
|
FROM golang:1.21-alpine as build
|
2020-12-22 10:45:08 +00:00
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
WORKDIR /tmp/adguard_exporter
|
|
|
|
|
2021-01-11 17:34:09 +00:00
|
|
|
RUN apk --no-cache add git alpine-sdk
|
2020-12-22 10:45:08 +00:00
|
|
|
COPY . .
|
2021-01-11 17:34:09 +00:00
|
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags '-s -w' -o adguard_exporter ./
|
2020-12-22 10:45:08 +00:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
LABEL name="adguard-exporter"
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
COPY --from=build /tmp/adguard_exporter/adguard_exporter adguard_exporter
|
|
|
|
|
2023-09-15 16:26:38 +00:00
|
|
|
CMD ["./adguard_exporter"]
|