Created
August 31, 2022 06:21
-
-
Save percybolmer/106c66b992cc7b5f0cf83de12d677f61 to your computer and use it in GitHub Desktop.
A multistage docker file showing how to copy go binary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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