-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (21 loc) · 939 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM golang:1.14-buster as build-env
ENV GOPROXY=https://proxy.golang.org
RUN apt-get -y update \
&& apt-get install -y make git upx wget curl tar musl* \
&& go get -u github.com/swaggo/swag/cmd/swag \
&& go get -u github.com/markbates/pkger/cmd/pkger
ARG BUILD_DATE
ARG VCS_REF
WORKDIR /opt/src
ADD . /opt/src
RUN export PATH=/go/bin:$PATH && \
swag init --generalInfo pkg/routers/routers.go pkg/routers && \
pkger -include /web/static/ -include /web/templates/ && \
CC=/usr/local/bin/musl-gcc CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/fiber-pongo2-pkger -a -ldflags '-extldflags "-static" -s -w' .
RUN upx /opt/src/build/fiber-pongo2-pkger
FROM scratch
# FROM gcr.io/distroless/base
COPY --from=build-env /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build-env /opt/src/build/fiber-pongo2-pkger /
COPY --from=build-env /opt/src/docs /
ENTRYPOINT ["/fiber-pongo2-pkger"]