Skip to content

Commit 8dabab0

Browse files
committed
split to 'docker-force' target as a guard for tagged commits only
1 parent 614d6a9 commit 8dabab0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ REBAR_CONFIG = rebar.OTP$(OTP_RELEASE).config
1616

1717
SRCS := $(wildcard src/* include/* rebar.config)
1818

19+
GIT_DESCRIBE := $(shell git describe --tags --first-parent --always --dirty)
20+
1921
.PHONY: all
2022
all: ebin/jesse.app bin/jesse
2123

@@ -156,15 +158,25 @@ rebar3.OTP24:
156158

157159
.PHONY: docker
158160
docker:
161+
if git tag | grep -q -Fx "$(GIT_DESCRIBE)"; then \
162+
$(MAKE) docker-force; \
163+
else \
164+
echo "Current version $(GIT_DESCRIBE) isn't in 'git tag'."; \
165+
echo "Run 'make docker-force' if you really want to build and push a $(GIT_DESCRIBE) version."; \
166+
exit 1
167+
fi
168+
169+
.PHONY: docker-force
170+
docker-force:
159171
# docker context create aws-docker-amd64 --docker host=ssh://ec2-13-51-198-153.eu-north-1.compute.amazonaws.com
160172
# docker context create aws-docker-arm64 --docker host=ssh://ec2-13-48-46-86.eu-north-1.compute.amazonaws.com
161173
# docker buildx create --name aws-multiarch-builder aws-docker-amd64
162174
# docker buildx create --name aws-multiarch-builder --append aws-docker-arm64
163-
# docker use aws-multiarch-builder
175+
# docker buildx use aws-multiarch-builder
164176
docker buildx build . \
165177
--push \
166178
--platform linux/amd64,linux/arm64 \
167-
--tag ysoftwareab/jesse:$$(git describe --tags --first-parent --always) \
179+
--tag ysoftwareab/jesse:$(GIT_DESCRIBE) \
168180
--build-arg FROM=erlang:latest \
169181
--build-arg LABEL_VCS_REF=$$(git rev-parse HEAD) \
170182
--build-arg LABEL_BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ")

0 commit comments

Comments
 (0)