.PHONY: *
-include .env.prod
export $(shell sed 's/=.*//' .env.prod)

# Replace env variables in index.html
build:
	pnpm run build

# Copy files to server
copy-files:
	rsync -avhzru -P -e ssh --include-from='prod.deploy.files.txt' --exclude '*' ./ $(SSH_TO_SERVER):$(PATH_APPS)/gb

# Deploy Immich
up-gb:
	ssh homelab "cd $(PATH_APPS)/gb && docker compose --env-file ../.env --env-file .env.prod -f prod.compose.yml up -d"

deploy:
	make build
	make copy-files
	make up-gb
