From 1871040de60fd4bf1fd47787a432740681eb938f Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 15:28:20 +0300 Subject: [PATCH 1/6] circleci: fix workflow version Only version 2 is supported at the moment as per https://circleci.com/docs/2.0/configuration-reference/#version-1 Not to confuse with top-level version which really can be 2.1. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0723232c6..783891fcb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: workflows: - version: 2.1 + version: 2 workflow: jobs: - vet: From 6964d86347ab2e422ec339ddefd02f2ba87e2a4a Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 15:48:05 +0300 Subject: [PATCH 2/6] circleci: fix make target name for Docker image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 783891fcb..8b57811b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,7 +87,7 @@ jobs: curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz tar -xz -C /tmp -f /tmp/docker-$VER.tgz mv /tmp/docker/* /usr/bin - - run: make build-image + - run: make image workflows: From a3890910f2fdc83fb5807fcaaa30d070bcae86d6 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 16:01:34 +0300 Subject: [PATCH 3/6] Dockerfile: use neo-go for binary name Be consistent with Makefile (see 3dfb1189f2828d99dca14b9da396ce4299ed46c3). --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8bbcaa4ad..bad1875ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN 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/node ./cli/main.go + && go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli/main.go # Executable image FROM alpine:3.10 @@ -31,9 +31,9 @@ WORKDIR / ENV NETMODE=testnet COPY --from=builder /neo-go/config /config -COPY --from=builder /go/bin/node /usr/bin/node +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/node"] +ENTRYPOINT ["/usr/bin/neo-go"] -CMD ["node", "--config-path", "./config", "--testnet"] +CMD ["neo-go", "--config-path", "./config", "--testnet"] From a168f09ac444c578398d10ebf00bbc6c1d24749e Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 16:05:32 +0300 Subject: [PATCH 4/6] Makefile: drop deps from image dependencies Docker builds shouldn't run go here to avoid CircleCI failures like this: make: go: Command not found make: *** [Makefile:32: deps] Error 127 Exited with code 2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 06cb00b08..13d47163e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ build: deps && export CGO_ENABLED=0 \ && go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go -image: deps +image: @echo "=> Building image" @docker build -t cityofzion/neo-go:latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) . @docker build -t cityofzion/neo-go:$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) . From b8ad0125b68d8b76e3783857ec8f1b185a3cf193 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 16:10:28 +0300 Subject: [PATCH 5/6] 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 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index bad1875ba..08656080f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ ARG VERSION=dev # 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 From ed6075e4ba1a15b1460d4ff4cddf178f3ab4aa3d Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 29 Aug 2019 16:13:32 +0300 Subject: [PATCH 6/6] Dockerfile: use gomod to fix build failures ---> Running in 0e7bb4ca4583 + export 'GOGC=off' + export 'GO111MODULE=on' + export 'CGO_ENABLED=0' + export 'LDFLAGS=-X /config.Version=0.5.0-pre-40-gb8ad012' + go build -v '-mod=vendor' -ldflags '-X /config.Version=0.5.0-pre-40-gb8ad012' -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 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' returned a non-zero code: 1 make: *** [Makefile:19: image] Error 1 Exited with code 2 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 08656080f..d48897746 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,8 @@ RUN set -x \ && export GO111MODULE=on \ && export CGO_ENABLED=0 \ && export LDFLAGS="-X ${REPO}/config.Version=${VERSION}" \ + && go mod tidy -v \ + && go mod vendor \ && go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli/main.go # Executable image