Skip to content

Instantly share code, notes, and snippets.

@yk-sgr
Created April 28, 2020 14:15
Show Gist options
  • Save yk-sgr/557010251723ebdb358ef5109839445b to your computer and use it in GitHub Desktop.
Save yk-sgr/557010251723ebdb358ef5109839445b to your computer and use it in GitHub Desktop.
Go Multistage Docker
FROM golang:latest as builder
WORKDIR /app
ADD . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -o server cmd/server/main.go
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/server .
CMD ["./server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment