2020-04-15 08:17:58 +00:00
|
|
|
FROM golang:1 as builder
|
2019-11-06 12:33:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
ENV GOGC off
|
|
|
|
ENV CGO_ENABLED 0
|
|
|
|
|
2020-04-15 08:17:58 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& apt update \
|
|
|
|
&& apt install -y upx-ucl
|
2019-11-06 12:33:46 +00:00
|
|
|
|
2020-04-15 08:17:58 +00:00
|
|
|
WORKDIR /src
|
2019-11-06 12:33:46 +00:00
|
|
|
COPY . /src
|
|
|
|
|
2020-04-15 08:17:58 +00:00
|
|
|
ARG VERSION=dev
|
|
|
|
ENV LDFLAGS "-w -s -X main.Version=${VERSION}"
|
|
|
|
RUN set -x \
|
2020-11-27 15:18:53 +00:00
|
|
|
&& go build \
|
|
|
|
-v \
|
|
|
|
-mod=vendor \
|
|
|
|
-trimpath \
|
|
|
|
-ldflags "${LDFLAGS} -X main.Build=$(date -u +%s%N) -X main.Prefix=HTTP_GW" \
|
|
|
|
-o /go/bin/neofs-gw ./ \
|
2020-04-15 08:17:58 +00:00
|
|
|
&& upx -3 /go/bin/neofs-gw
|
2019-11-06 12:33:46 +00:00
|
|
|
|
|
|
|
# Executable image
|
2020-04-15 08:17:58 +00:00
|
|
|
FROM scratch
|
2019-11-06 12:33:46 +00:00
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
COPY --from=builder /go/bin/neofs-gw /bin/neofs-gw
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2019-12-13 16:18:45 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/neofs-gw"]
|