forked from TrueCloudLab/frostfs-http-gw
[#159] Unify docker targets for binary building
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
6684ea1e3a
commit
0a0af13bea
1 changed files with 12 additions and 19 deletions
31
Makefile
31
Makefile
|
@ -14,20 +14,11 @@ BINDIR = bin
|
||||||
DIRS = $(BINDIR)
|
DIRS = $(BINDIR)
|
||||||
BINS = $(BINDIR)/neofs-http-gw
|
BINS = $(BINDIR)/neofs-http-gw
|
||||||
|
|
||||||
.PHONY: all docker/all $(BINS) $(DIRS) docker/$(BINS) dep test cover fmt image image-push dirty-image lint docker/lint version clean
|
.PHONY: all $(BINS) $(DIRS) dep docker/ test cover fmt image image-push dirty-image lint docker/lint version clean
|
||||||
|
|
||||||
# Make all binaries
|
# Make all binaries
|
||||||
all: $(BINS)
|
all: $(BINS)
|
||||||
|
|
||||||
docker/all:
|
|
||||||
@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 all
|
|
||||||
|
|
||||||
$(BINS): $(DIRS) dep
|
$(BINS): $(DIRS) dep
|
||||||
@echo "⇒ Build $@"
|
@echo "⇒ Build $@"
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
|
@ -40,15 +31,6 @@ $(DIRS):
|
||||||
@echo "⇒ Ensure dir: $@"
|
@echo "⇒ Ensure dir: $@"
|
||||||
@mkdir -p $@
|
@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
|
# Pull go dependencies
|
||||||
dep:
|
dep:
|
||||||
@printf "⇒ Download requirements: "
|
@printf "⇒ Download requirements: "
|
||||||
|
@ -60,6 +42,17 @@ dep:
|
||||||
GO111MODULE=on \
|
GO111MODULE=on \
|
||||||
go mod tidy -v && echo OK
|
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
|
# Run tests
|
||||||
test:
|
test:
|
||||||
@go test ./... -cover
|
@go test ./... -cover
|
||||||
|
|
Loading…
Reference in a new issue