Created
November 1, 2018 00:35
-
-
Save sguzman/f162d286185f007fd8287a08e287bb6b to your computer and use it in GitHub Desktop.
A good image for building golang static executables then tranferring executable to alpine
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 as base | |
RUN mkdir /app | |
ADD . /app/ | |
WORKDIR /app | |
RUN go get -u "github.com/gin-gonic/gin" | |
RUN go get -u "github.com/lib/pq" | |
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s -extldflags -static" -o main . | |
FROM alpine | |
COPY --from=base /app/main /main | |
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | |
ENTRYPOINT ["/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment