Skip to content

Commit

Permalink
split to 'docker-force' target as a guard for tagged commits only
Browse files Browse the repository at this point in the history
  • Loading branch information
andreineculau committed May 7, 2022
1 parent 614d6a9 commit 8dabab0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ REBAR_CONFIG = rebar.OTP$(OTP_RELEASE).config

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

GIT_DESCRIBE := $(shell git describe --tags --first-parent --always --dirty)

.PHONY: all
all: ebin/jesse.app bin/jesse

Expand Down Expand Up @@ -156,15 +158,25 @@ rebar3.OTP24:

.PHONY: docker
docker:
if git tag | grep -q -Fx "$(GIT_DESCRIBE)"; then \
$(MAKE) docker-force; \
else \
echo "Current version $(GIT_DESCRIBE) isn't in 'git tag'."; \
echo "Run 'make docker-force' if you really want to build and push a $(GIT_DESCRIBE) version."; \
exit 1
fi

.PHONY: docker-force
docker-force:
# docker context create aws-docker-amd64 --docker host=ssh://ec2-13-51-198-153.eu-north-1.compute.amazonaws.com
# docker context create aws-docker-arm64 --docker host=ssh://ec2-13-48-46-86.eu-north-1.compute.amazonaws.com
# docker buildx create --name aws-multiarch-builder aws-docker-amd64
# docker buildx create --name aws-multiarch-builder --append aws-docker-arm64
# docker use aws-multiarch-builder
# docker buildx use aws-multiarch-builder
docker buildx build . \
--push \
--platform linux/amd64,linux/arm64 \
--tag ysoftwareab/jesse:$$(git describe --tags --first-parent --always) \
--tag ysoftwareab/jesse:$(GIT_DESCRIBE) \
--build-arg FROM=erlang:latest \
--build-arg LABEL_VCS_REF=$$(git rev-parse HEAD) \
--build-arg LABEL_BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ")

0 comments on commit 8dabab0

Please sign in to comment.