Skip to content

Instantly share code, notes, and snippets.

@jinjie
Last active December 9, 2022 12:45
Show Gist options
  • Save jinjie/1ea7e8029b4a97564e7f655d652a928e to your computer and use it in GitHub Desktop.
Save jinjie/1ea7e8029b4a97564e7f655d652a928e to your computer and use it in GitHub Desktop.
Example Dockerfile creating lean image for Go apps (Multi-stage build)
FROM golang:1.19-alpine as build
WORKDIR /app/
ADD . /app/
RUN go get
RUN CGO_ENABLED=0 go build -o mainApp .
FROM scratch
COPY --from=build /app/mainApp /
CMD [ "/mainApp" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment