STACK=pablotj-portfolio
APP_NAME=pablotj-portfolio-web
IMAGE_NAME=$(APP_NAME)

REGISTRY_URL=registry.nortapp.com
NAMESPACE=andromeda
TAG?=latest

IMAGE_FULL=$(REGISTRY_URL)/$(NAMESPACE)/$(IMAGE_NAME):$(TAG)

build:
	docker build -t $(IMAGE_NAME):$(TAG) .

tag:
	docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_FULL)

push:
	docker push $(IMAGE_FULL)

run:
	docker run -d \
		--name $(APP_NAME) \
		--label com.docker.compose.service="$(APP_NAME)" \
		--label com.docker.compose.project="$(STACK)" \
		--network andromeda \
		--env-file .env \
		$(IMAGE_FULL)

stop:
	docker stop $(APP_NAME) || true
	docker rm $(APP_NAME) || true

deploy: build tag push stop run