Use multi-stage build to get a small docker image

This commit is contained in:
Ask Bjørn Hansen 2021-09-05 01:22:07 -07:00
parent cfd126731a
commit ad5eef7ef8

View File

@ -1,8 +1,10 @@
FROM golang:1.17-alpine
FROM golang:1.17-alpine AS build
WORKDIR /app
COPY . ./
RUN go mod download
RUN go build -o /bin/prometheus-dnssec-exporter
ENTRYPOINT [ "/bin/prometheus-dnssec-exporter" ]
FROM alpine:3.14.2
COPY --from=build /bin/prometheus-dnssec-exporter /bin/prometheus-dnssec-exporter
ENTRYPOINT [ "/bin/prometheus-dnssec-exporter" ]