neo-go/Dockerfile
Roman Khimov b8ad0125b6 Dockerfile: add GO111MODULE export
Maybe fixes this one:
 ---> Running in 3b964b007f22
+ export 'GOGC=off'
+ export 'CGO_ENABLED=0'
+ export 'LDFLAGS=-X /config.Version=0.5.0-pre-39-ga168f09'
+ go build -v '-mod=vendor' -ldflags '-X /config.Version=0.5.0-pre-39-ga168f09' -o /go/bin/neo-go ./cli/main.go
build command-line-arguments: cannot load github.com/go-redis/redis: open /neo-go/vendor/github.com/go-redis/redis: no such file or directory
The command '/bin/sh -c set -x     && export GOGC=off     && export CGO_ENABLED=0     && export LDFLAGS="-X ${REPO}/config.Version=${VERSION}"     && go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli/main.go' returned a non-zero code: 1
make: *** [Makefile:19: image] Error 1
2019-08-29 16:10:28 +03:00

40 lines
957 B
Docker

# Builder image
FROM golang:1.12-alpine3.10 as builder
RUN set -x \
&& apk add --no-cache git \
&& mkdir -p /tmp
COPY . /neo-go
WORKDIR /neo-go
ARG REPO=repository
ARG VERSION=dev
# 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 GO111MODULE=on \
&& export CGO_ENABLED=0 \
&& export LDFLAGS="-X ${REPO}/config.Version=${VERSION}" \
&& go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli/main.go
# Executable image
FROM alpine:3.10
ENV NETMODE=testnet
ARG VERSION
LABEL version=$VERSION
WORKDIR /
ENV NETMODE=testnet
COPY --from=builder /neo-go/config /config
COPY --from=builder /go/bin/neo-go /usr/bin/neo-go
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/usr/bin/neo-go"]
CMD ["neo-go", "--config-path", "./config", "--testnet"]