[#471] Add docker/* target in Makefile

Allowed targets:
- docker/all
- docker/bin/neofs-s3-gw
- docker/bin/neofs-authmate
- docker/lint

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-06-15 13:30:55 +03:00 committed by Alex Vanin
parent 880ffe7108
commit f1a2611043
3 changed files with 16 additions and 2 deletions

View file

@ -1,2 +1,3 @@
.git
.cache
.github

View file

@ -3,6 +3,7 @@
# Common variables
REPO ?= $(shell go list -m)
VERSION ?= $(shell git describe --tags 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")
GO_VERSION ?= 1.17
BINDIR = bin
# Binaries to build
@ -14,7 +15,7 @@ REPO_BASENAME = $(shell basename `go list -m`)
HUB_IMAGE ?= "nspccdev/$(REPO_BASENAME)"
HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')"
.PHONY: help all dep clean format test cover lint docker/lint image-push image dirty-image
.PHONY: help all dep docker/ clean format test cover lint docker/lint image-push image dirty-image
# Make all binaries
all: $(BINS)
@ -39,6 +40,17 @@ dep:
@CGO_ENABLED=0 \
go mod tidy -v && echo OK
docker/%:
$(if $(filter $*,all $(BINS)), \
@echo "=> Running 'make $*' in clean Docker environment" && \
docker run --rm -t \
-v `pwd`:/src \
-w /src \
-u `stat -c "%u:%g" .` \
--env HOME=/src \
golang:$(GO_VERSION) make $*,\
@echo "supported docker targets: all $(BINS) lint")
# Run tests
test:
@go test ./... -cover

View file

@ -8,8 +8,9 @@ NeoFS S3 gateway provides API compatible with Amazon S3 cloud storage service.
Or you can call `make` to build it from the cloned repository (the binary will
end up in `bin/neofs-s3-gw` with authmate helper in `bin/neofs-authmate`).
To build binaries in clean docker environment, call `make docker/all`.
Notable make targets:
Other notable make targets:
```
dep Check and ensure dependencies