diff --git a/.dockerignore b/.dockerignore index f4b1198..09348a5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ .git +.cache .github diff --git a/Makefile b/Makefile index 6f58f82..76fb77e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 5ed91e3..8d7aaeb 100644 --- a/README.md +++ b/README.md @@ -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