Adjust dockerfile to my liking

This commit is contained in:
Phil Porada 2024-05-20 13:55:24 -04:00
parent 9a89f5d0b7
commit d19cc94bda
No known key found for this signature in database
GPG Key ID: DB4D7113D4614DD6

View File

@ -1,15 +1,9 @@
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.21.4-bookworm AS build
VOLUME . /go/src/app
WORKDIR /go/src/app
COPY . .
RUN go mod download
ENV CGO_ENABLED=0
RUN GOOS=$TARGETOS GOARCH=$TARGETPLATFORM go build -v -o /go/bin/unbound_exporter ./...
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETPLATFORM go build -v -o /go/bin/unbound_exporter
FROM gcr.io/distroless/static-debian12
COPY --from=build /go/bin/unbound_exporter /
ENTRYPOINT ["/unbound_exporter"]