Skip to content

Instantly share code, notes, and snippets.

@hashamali
Created October 28, 2019 23:24
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 hashamali/7a0284a6abe1fc267eaf7d01f757ef42 to your computer and use it in GitHub Desktop.
Save hashamali/7a0284a6abe1fc267eaf7d01f757ef42 to your computer and use it in GitHub Desktop.
Dockerfile for Go Builds
# Build
FROM golang:1.11-alpine
RUN apk add git
ADD . $GOPATH/src/myproject
WORKDIR $GOPATH/src/myproject
RUN go get myproject
RUN go install myproject
# Run
FROM alpine:latest
COPY --from=0 /go/bin/myproject .
ENV PORT 8080
CMD ["./myproject"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment