2019-08-26 14:26:42 +00:00
|
|
|
# Builder image
|
|
|
|
FROM golang:1.12-alpine3.10 as builder
|
2018-04-16 08:41:23 +00:00
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& apk add --no-cache git \
|
|
|
|
&& mkdir -p /tmp
|
|
|
|
|
|
|
|
COPY . /neo-go
|
|
|
|
|
|
|
|
WORKDIR /neo-go
|
|
|
|
|
|
|
|
ARG REPO=repository
|
|
|
|
ARG VERSION=dev
|
2018-04-16 08:41:23 +00:00
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
# https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
|
|
|
|
# go build -mod=vendor
|
|
|
|
RUN set -x \
|
|
|
|
&& export GOGC=off \
|
|
|
|
&& export CGO_ENABLED=0 \
|
2019-08-28 19:09:36 +00:00
|
|
|
&& export LDFLAGS="-X ${REPO}/config.Version=${VERSION}" \
|
2019-08-29 13:01:34 +00:00
|
|
|
&& go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli/main.go
|
2019-08-26 14:26:42 +00:00
|
|
|
|
|
|
|
# Executable image
|
|
|
|
FROM alpine:3.10
|
|
|
|
|
|
|
|
ENV NETMODE=testnet
|
|
|
|
ARG VERSION
|
2018-04-16 08:41:23 +00:00
|
|
|
LABEL version=$VERSION
|
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
ENV NETMODE=testnet
|
|
|
|
COPY --from=builder /neo-go/config /config
|
2019-08-29 13:01:34 +00:00
|
|
|
COPY --from=builder /go/bin/neo-go /usr/bin/neo-go
|
2019-08-26 14:26:42 +00:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2018-04-16 08:41:23 +00:00
|
|
|
|
2019-08-29 13:01:34 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/neo-go"]
|
2018-04-16 08:41:23 +00:00
|
|
|
|
2019-08-29 13:01:34 +00:00
|
|
|
CMD ["neo-go", "--config-path", "./config", "--testnet"]
|