1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| FROM golang:alpine as build
WORKDIR /go/src/app
COPY . .
RUN apk --no-cache add ca-certificates upx && \
CGO_ENABLED=0 go build -ldflags '-s -w -extldflags "-static"' -o /go/bin/app ./main.go \
&& upx -9 /go/bin/app
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /go/bin/app /app
ENTRYPOINT ["/app"]
|