Last active
October 21, 2020 04:02
-
-
Save AngerM/08d538e1348742cd1ec6d27ab1996316 to your computer and use it in GitHub Desktop.
GOLANG MODULES CGO Enabled Docker build
This file contains 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:buster AS build_base | |
WORKDIR /go/src/app | |
COPY go.mod . | |
COPY go.sum . | |
ENV GO111MODULE=on | |
ENV GOOS=linux | |
ENV GOARCH=amd64 | |
RUN go mod download | |
FROM build_base as builder | |
COPY . . | |
RUN go build -o app | |
#final stage | |
FROM debian:buster-slim | |
RUN apt update | |
RUN apt install -y ca-certificates | |
COPY --from=builder /go/src/app/app /app | |
ENTRYPOINT ./app | |
EXPOSE 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment