2019-05-24 15:13:15 +02:00
|
|
|
# Copyright (c) JSC iCore.
|
|
|
|
|
|
|
|
# This source code is licensed under the MIT license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree.
|
2019-02-18 14:57:54 +01:00
|
|
|
|
2019-05-15 14:03:05 +02:00
|
|
|
FROM golang:1.12-alpine AS build
|
2019-02-18 14:57:54 +01:00
|
|
|
|
|
|
|
ARG VERSION
|
|
|
|
ARG GOPROXY
|
|
|
|
|
|
|
|
WORKDIR /opt/build
|
|
|
|
|
|
|
|
RUN adduser -D -g '' appuser
|
|
|
|
RUN apk --update add ca-certificates
|
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
|
|
|
COPY cmd cmd
|
|
|
|
COPY internal internal
|
2019-05-24 15:13:15 +02:00
|
|
|
RUN env CGO_ENABLED=0 go install -ldflags="-w -s -X main.version=${VERSION}" ./...
|
2019-02-18 14:57:54 +01:00
|
|
|
|
|
|
|
FROM scratch AS final
|
|
|
|
COPY --from=build /etc/passwd /etc/passwd
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
COPY --from=build /go/bin/werther /werther
|
|
|
|
|
|
|
|
USER appuser
|
|
|
|
ENTRYPOINT ["/werther"]
|