Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created August 31, 2022 06:21
Show Gist options
  • Save percybolmer/106c66b992cc7b5f0cf83de12d677f61 to your computer and use it in GitHub Desktop.
Save percybolmer/106c66b992cc7b5f0cf83de12d677f61 to your computer and use it in GitHub Desktop.
A multistage docker file showing how to copy go binary
FROM golang:1.9 AS builder
WORKDIR /
# copy everything from host folder into this image
COPY . .
# Build binary and place it at /main
RUN go build -o /main
# Initiate the Second Build stage
FROM scratch
COPY --from=builder /main /main
ENTRYPOINT ["/main"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment