From 80a2eb6774fb4ac4a95bb2bde52e828bef38c67d Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 7 Jun 2022 15:51:43 +0300 Subject: [PATCH] Makefile: add docker/neo-go make target --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 568d135fa..9c8b4fcb6 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ REPONAME = "neo-go" NETMODE ?= "privnet" BINARY=neo-go BINARY_PATH=./bin/$(BINARY)$(shell go env GOEXE) +GO_VERSION ?= 1.18 DESTDIR = "" SYSCONFIGDIR = "/etc" BINDIR = "/usr/bin" @@ -23,7 +24,7 @@ IMAGE_REPO=nspccdev/neo-go # All of the targets are phony here because we don't really use make dependency # tracking for files -.PHONY: build $(BINARY) deps image image-latest image-push image-push-latest check-version clean-cluster push-tag \ +.PHONY: build $(BINARY) deps image docker/$(BINARY) image-latest image-push image-push-latest check-version clean-cluster push-tag \ test vet lint fmt cover build: deps @@ -35,6 +36,15 @@ build: deps $(BINARY): build +docker/$(BINARY): + @echo "=> Building binary using clean Docker environment" + @docker run --rm -t \ + -v `pwd`:/src \ + -w /src \ + -u "$$(id -u):$$(id -g)" \ + --env HOME=/src \ + golang:$(GO_VERSION) make $(BINARY) + neo-go.service: neo-go.service.template @sed -r -e 's_BINDIR_$(BINDIR)_' -e 's_UNITWORKDIR_$(UNITWORKDIR)_' -e 's_SYSCONFIGDIR_$(SYSCONFIGDIR)_' $< >$@