2020-07-19 12:02:08 +02:00
|
|
|
FROM golang:1.14 AS builder
|
2019-12-14 07:33:24 +01:00
|
|
|
COPY . /app
|
|
|
|
WORKDIR /app
|
2020-07-19 16:19:01 +02:00
|
|
|
ARG GOARCH=amd64
|
2019-12-14 07:33:24 +01:00
|
|
|
RUN go generate
|
|
|
|
RUN \
|
|
|
|
CGO_ENABLED=0 \
|
|
|
|
GOOS=linux \
|
|
|
|
GOPROXY=https://proxy.golang.org,direct \
|
2020-07-19 16:19:01 +02:00
|
|
|
go build -ldflags "-s -w" -o main .
|
2019-12-14 07:33:24 +01:00
|
|
|
|
|
|
|
FROM scratch
|
2020-07-19 16:19:01 +02:00
|
|
|
COPY contrib/etc/group contrib/etc/passwd /etc/
|
2019-12-14 07:33:24 +01:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
COPY --from=builder /app/main /main
|
|
|
|
USER user
|
|
|
|
ENTRYPOINT ["/main"]
|
2020-07-19 16:19:01 +02:00
|
|
|
CMD ["server"]
|