Created
October 12, 2018 22:58
-
-
Save lfaoro/b2cb6feeedeaa9c3151372b881520f48 to your computer and use it in GitHub Desktop.
Compile multiple Go programs and load them all in a light container
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:alpine as builder | |
WORKDIR /build | |
COPY . . | |
RUN apk update && apk upgrade && \ | |
apk add git gcc | |
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \ | |
go install -gcflags "-N -l" ./cmd/... | |
FROM alpine:latest | |
RUN apk update && apk add ca-certificates && \ | |
rm -rf /var/cache/apk/* | |
COPY --from=builder /go/bin/ /usr/local/bin/ | |
COPY --from=builder /build/static/ /usr/local/bin/static/ | |
WORKDIR /usr/local/bin/ | |
CMD ["server", "-hostPort", ":8080", "-devel=false"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment