Skip to content

Instantly share code, notes, and snippets.

@asolera
Created May 19, 2020 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asolera/6560bc41875f2e3ed9feca22b9c71003 to your computer and use it in GitHub Desktop.
Save asolera/6560bc41875f2e3ed9feca22b9c71003 to your computer and use it in GitHub Desktop.
Golang minimal Dockerfile image
FROM golang:1.14.3-alpine3.11 AS build
RUN apk add --no-cache git
RUN go get github.com/docker/docker/api/types
RUN go get github.com/docker/docker/client
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