export VERSION_FROM_AUTOTOOLS = v$(VERSION) DOCKER_DEVELOPER_TARGETS = docker .PHONY: $(DOCKER_DEVELOPER_TARGETS) export DOCKER_REGISTRY ?= ghcr.io export DOCKER_REPO ?= theleagueof/$(TRANSFORMED_PACKAGE_NAME) export DOCKER_TAG ?= HEAD docker: Dockerfile hooks/build .version ./hooks/build $(VERSION) docker-build-push: docker docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) $(docker_push) define docker_push = test -z "$(DOCKER_PAT)" || \ docker login https://$(DOCKER_REGISTRY) -u $(DOCKER_USERNAME) -p $(DOCKER_PAT) docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) if [[ "$(DOCKER_TAG)" == v*.*.* ]]; then \ tag=$(DOCKER_TAG) ; \ docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ; \ docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ; \ docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ; \ docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ; \ fi endef