[#159] Add docker/$(BINS) target

Use this target to build binaries in clean docker environment.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-06-07 19:58:33 +03:00 committed by Alex Vanin
parent b0b724393a
commit 5baa2774d5
2 changed files with 15 additions and 4 deletions

View file

@ -2,6 +2,7 @@
REPO ?= $(shell go list -m)
VERSION ?= $(shell git describe --tags --dirty --always)
GO_VERSION ?= 1.17
BUILD ?= $(shell date -u --iso=seconds)
HUB_IMAGE ?= nspccdev/neofs-http-gw
@ -10,9 +11,9 @@ HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')"
# List of binaries to build. For now just one.
BINDIR = bin
DIRS = $(BINDIR)
BINS = "$(BINDIR)/neofs-http-gw"
BINS = $(BINDIR)/neofs-http-gw
.PHONY: help all dep clean fmts fmt imports test cover lint docker/lint
.PHONY: help all $(BINS) $(DIRS) docker/$(BINS) dep test cover fmts fmt imports image image-push dirty-image lint docker/lint version clean
# Make all binaries
all: $(BINS)
@ -29,6 +30,15 @@ $(DIRS):
@echo "⇒ Ensure dir: $@"
@mkdir -p $@
docker/$(BINS):
@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 $(BINS)
# Pull go dependencies
dep:
@printf "⇒ Download requirements: "

View file

@ -21,9 +21,10 @@ NeoFS HTTP Gateway bridges NeoFS internal protocol and HTTP standard.
```go install github.com/nspcc-dev/neofs-http-gw```
Or you can call `make` to build it from the cloned repository (the binary will
end up in `bin/neofs-http-gw`).
end up in `bin/neofs-http-gw`). To build neofs-http-gw binary in clean docker
environment, call `make docker/bin/neofs-http-gw`.
Notable make targets:
Other notable make targets:
```
dep Check and ensure dependencies