FROM --platform=$BUILDPLATFORM golang:alpine as build ARG TARGETOS ARG TARGETARCH ARG TARGETVARIANT WORKDIR /usr/src/fritzbox_exporter COPY . . RUN go mod download; \ case "$TARGETVARIANT" in \ v5) export GOARM=5 ;; \ v6) export GOARM=6 ;; \ v7) export GOARM=7 ;; \ esac; \ CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags '-w -extldflags "-static"' -o fritzbox-exporter . FROM --platform=$TARGETPLATFORM alpine:latest RUN apk --no-cache add ca-certificates COPY --from=build /usr/src/fritzbox_exporter/fritzbox-exporter /bin/ COPY --from=build /usr/src/fritzbox_exporter/*.json /etc/fritzbox-exporter/ ENTRYPOINT ["/bin/fritzbox-exporter"] CMD ["--metrics-file","/etc/fritzbox-exporter/metrics.json","--lua-metrics-file","/etc/fritzbox-exporter/metrics-lua.json","--listen-address","0.0.0.0:8080"]