Skip to content

Instantly share code, notes, and snippets.

@rahul-yr
Created September 18, 2022 13:13
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 rahul-yr/c250d3f9b16d23b0ae48e38d95915aff to your computer and use it in GitHub Desktop.
Save rahul-yr/c250d3f9b16d23b0ae48e38d95915aff to your computer and use it in GitHub Desktop.
Docker Golang light weight image Dockerfile
FROM golang:1.19.1-alpine3.16 as builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . ./
RUN go build -v -o server
FROM alpine:3.16
COPY --from=builder /app/server /app/server
EXPOSE 8080
CMD ["/app/server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment