.PHONY: stage prod build tag push

-include .env.production .env.development

REGISTRY := git.workaround.org/chaas

stage: TAG=latest
stage: build tag push
	curl -s -H "Authorization: Bearer $(COOLIFY_STAGE_DEPLOY_TOKEN)" \
	  -X POST "$(COOLIFY_STAGE_DEPLOY_WEBHOOK)"

prod: TAG=prod
prod: build tag push
	curl -s -H "Authorization: Bearer $(COOLIFY_PROD_DEPLOY_TOKEN)" \
	  -X POST "$(COOLIFY_PROD_DEPLOY_WEBHOOK)"

build:
	docker build --build-arg GIT_REV=$(shell git rev-parse --short HEAD) -t debshots-$(TAG) .

tag:
	docker tag debshots-$(TAG) $(REGISTRY)/debshots:$(TAG)

push:
	docker push $(REGISTRY)/debshots:$(TAG)

