Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2020 01:19
What would you like to do?
Golang minimal Dockerfile image
FROM golang:1.14.3-alpine3.11 AS build
RUN apk add --no-cache git
RUN go get
RUN go get
RUN apk del git
WORKDIR /go/src/myapp
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/myapp .
FROM scratch
COPY --from=build /bin/myapp /bin/myapp
ENTRYPOINT ["/bin/myapp"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment