Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
Dockerfile with go builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Tuzhilkin committed Jan 14, 2020
1 parent 9a8c754 commit a4e06e1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
FROM golang:1.13-alpine as builder

RUN apk add --no-cache git gcc libc-dev

ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0

COPY $PWD/ /go/src/app/
WORKDIR /go/src/app/

RUN go get app && go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /go/bin/prometheus-digitalocean-sd

# Final image
FROM gcr.io/distroless/base
COPY prometheus-digitalocean-sd /prometheus-digitalocean-sd

COPY --from=builder /go/bin/prometheus-digitalocean-sd /prometheus-digitalocean-sd

ENTRYPOINT ["/prometheus-digitalocean-sd"]

0 comments on commit a4e06e1

Please sign in to comment.