Skip to content

Instantly share code, notes, and snippets.

@DonBattery
Created December 15, 2019 08:25
Show Gist options
  • Save DonBattery/11b7a04c9ecde487fd6fb49b4d6964c5 to your computer and use it in GitHub Desktop.
Save DonBattery/11b7a04c9ecde487fd6fb49b4d6964c5 to your computer and use it in GitHub Desktop.
Multistage Golang Dockerfile
FROM golang AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o my-app .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/my-app .
COPY my-app-config.yaml .
CMD ["./my-app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment