[#57] *: Fix docker builds

Added dep dependency before image target, made `run make` without dep
in dockerfile.

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2021-05-24 14:24:01 +03:00
parent a565c4fd50
commit d87a5a89d6
2 changed files with 6 additions and 3 deletions

View file

@ -8,9 +8,10 @@ RUN set -x \
COPY . /src COPY . /src
ARG REPO=github.com/nspcc-dev/neofs-s3-gw
ARG VERSION=dev ARG VERSION=dev
RUN make RUN set -x && make -o dep # run make without dep dependency
# Executable image # Executable image
FROM scratch FROM scratch
@ -18,6 +19,7 @@ FROM scratch
WORKDIR / WORKDIR /
COPY --from=builder /src/bin/neofs-s3-gw /bin/neofs-s3-gw COPY --from=builder /src/bin/neofs-s3-gw /bin/neofs-s3-gw
COPY --from=builder /src/bin/neofs-authmate /bin/neofs-authmate
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/bin/neofs-s3-gw"] ENTRYPOINT ["/bin/neofs-s3-gw"]

View file

@ -10,7 +10,8 @@ CMDS = $(addprefix neofs-, $(notdir $(wildcard cmd/*)))
BINS = $(addprefix $(BINDIR)/, $(CMDS)) BINS = $(addprefix $(BINDIR)/, $(CMDS))
# Variables for docker # Variables for docker
HUB_IMAGE ?= "nspccdev/$(BIN_NAME)" REPO_BASENAME = $(shell basename `go list -m`)
HUB_IMAGE ?= "nspccdev/$(REPO_BASENAME)"
HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" 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 clean format test cover lint docker/lint image-push image dirty-image
@ -55,7 +56,7 @@ format:
@goimports -w ./ @goimports -w ./
# Build clean Docker image # Build clean Docker image
image: image: dep
@echo "⇒ Build NeoFS S3 Gateway docker image " @echo "⇒ Build NeoFS S3 Gateway docker image "
@docker build \ @docker build \
--build-arg REPO=$(REPO) \ --build-arg REPO=$(REPO) \