| .PHONY: help build up down logs clean test-backend test-frontend restart |
|
|
| help: |
| @echo 'Usage: make [target]' |
| @echo '' |
| @echo 'Available targets:' |
| @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
|
|
| build: |
| @echo "Building backend Docker image..." |
| docker-compose build backend |
| @echo "β
Build complete!" |
|
|
| up: |
| @echo "Starting services..." |
| docker-compose up -d |
| @echo "β
Services started!" |
| @echo "Backend API: http://localhost:8000" |
| @echo "Frontend UI: http://localhost:8501" |
| @echo "API Docs: http://localhost:8000/docs" |
|
|
| down: |
| @echo "Stopping services..." |
| docker-compose down |
| @echo "β
Services stopped!" |
|
|
| logs: |
| docker-compose logs -f |
|
|
| logs-backend: |
| docker-compose logs -f backend |
|
|
| logs-frontend: |
| docker-compose logs -f frontend |
|
|
| restart: |
| @echo "Restarting services..." |
| docker-compose restart |
| @echo "β
Services restarted!" |
|
|
| clean: |
| @echo "Cleaning up..." |
| docker-compose down -v |
| @echo "β
Cleanup complete!" |
|
|
| test-backend: |
| @echo "Testing backend..." |
| @docker build -t land-redistribution-test ./backend |
| @docker run --rm -p 7860:7860 -d --name backend-test land-redistribution-test |
| @sleep 5 |
| @echo "Testing health endpoint..." |
| @curl -f http://localhost:7860/health || (docker stop backend-test && exit 1) |
| @echo "\nβ
Backend test passed!" |
| @docker stop backend-test |
|
|
| dev-backend: |
| @echo "Starting backend in development mode..." |
| cd backend && uvicorn main:app --reload --port 8000 |
|
|
| dev-frontend: |
| @echo "Starting frontend in development mode..." |
| cd frontend && streamlit run app.py --server.port 8501 |
|
|
| install-backend: |
| cd backend && pip install -r requirements.txt |
|
|
| install-frontend: |
| cd frontend && pip install -r requirements.txt |
|
|
| install: install-backend install-frontend |
|
|
| status: |
| docker-compose ps |
|
|
| health: |
| @echo "Checking backend health..." |
| @curl -s http://localhost:8000/health | python -m json.tool || echo "β Backend not responding" |
| @echo "\nChecking frontend..." |
| @curl -s -o /dev/null -w "Status: %{http_code}\n" http://localhost:8501 || echo "β Frontend not responding" |
|
|