.PHONY: help requirements docker-build docker-up docker-down clean start tunnels_up

help:
	@echo "Available commands:"
	@echo "  make sync_requirements    - Export dependencies from pyproject.toml to requirements.txt"
	@echo "  make tunnels_up                - Start tunnels"
	@echo "  make compose_up                - Run tunnels script and start Docker Compose"

.PHONY: sync_requirements
sync_requirements:
	@echo "Exporting dependencies from pyproject.toml to requirements.txt..."
	uv export --format requirements-txt --no-hashes --no-dev -o Docker/requirements.txt
	@echo "✓ requirements.txt updated successfully"

.PHONY: tunnels_up
tunnels_up:
	bash ./scripts/start-tunnels.sh < /dev/null &
	@echo "✓ Tunnels started!"

.PHONY: compose_up
compose_up:
	bash ./scripts/start-tunnels.sh < /dev/null &
	sleep 2
	docker compose -f Docker/docker-compose.yaml --env-file .env up -d --build
	@echo "✓ Done!"

# Kill all kubectl port-forward tunnels
.PHONY: tunnels_down
tunnels_down:
	@echo "Killing all kubectl port-forward tunnels..."
	-pkill -f 'kubectl port-forward' || true
	@echo "✓ All tunnels killed!"

.PHONY: sync_data_down
sync_data_down:
	aws s3 sync s3://mrh-avap/data/ \
		data/ 
	
## Upload Data to storage system
.PHONY: sync_data_up
sync_data_up:
	aws s3 sync --exclude "*.gitkeep" data/ \
		s3://mrh-avap/data 

.PHONY: ollama_local
ollama_local:
	ssh -i ~/.ssh/mrh-transformers.pem -L 11434:localhost:11434 ubuntu@172.18.14.34
