Spaces:
Sleeping
Sleeping
| # Makefile for MCP Sentiment Analysis Server | |
| # Variables | |
| IMAGE_NAME = mcp-sentiment | |
| CONTAINER_NAME = mcp-sentiment-container | |
| PORT = 7860 | |
| DOCKER_REGISTRY = | |
| VERSION = latest | |
| # Default target | |
| help: | |
| @echo "MCP Sentiment Analysis Server - Development Commands" | |
| @echo "==================================================" | |
| @echo "" | |
| @echo "Development:" | |
| @echo " install Install Python dependencies locally" | |
| @echo " run Run the server locally (without Docker)" | |
| @echo " test Run tests locally" | |
| @echo "" | |
| @echo "Docker:" | |
| @echo " build Build Docker image" | |
| @echo " run-docker Run Docker container" | |
| @echo " stop Stop Docker container" | |
| @echo " logs Show Docker container logs" | |
| @echo " shell Open shell in running container" | |
| @echo "" | |
| @echo "Testing:" | |
| @echo " test-docker Test Docker container" | |
| @echo " test-all Run all tests (local + Docker)" | |
| @echo "" | |
| @echo "Deployment:" | |
| @echo " deploy-hf Deploy to Hugging Face Spaces (interactive)" | |
| @echo "" | |
| @echo "Cleanup:" | |
| @echo " clean Remove Docker containers and images" | |
| @echo " clean-all Remove everything including volumes" | |
| # Development targets | |
| install: | |
| pip install -r requirements.txt | |
| run: | |
| python app.py | |
| test: | |
| python test_mcp_server.py | |
| # Docker targets | |
| build: | |
| docker build -t $(IMAGE_NAME):$(VERSION) . | |
| run-docker: build | |
| docker run -d \ | |
| --name $(CONTAINER_NAME) \ | |
| -p $(PORT):7860 \ | |
| $(IMAGE_NAME):$(VERSION) | |
| @echo "Container started. Access at http://localhost:$(PORT)" | |
| @echo "MCP endpoint: http://localhost:$(PORT)/gradio_api/mcp/sse" | |
| stop: | |
| -docker stop $(CONTAINER_NAME) | |
| -docker rm $(CONTAINER_NAME) | |
| logs: | |
| docker logs -f $(CONTAINER_NAME) | |
| shell: | |
| docker exec -it $(CONTAINER_NAME) /bin/bash | |
| # Testing targets | |
| test-docker: | |
| python test_mcp_server.py --server --wait | |
| test-all: test test-docker | |
| # Deployment targets | |
| deploy-hf: | |
| @echo "Deploying to Hugging Face Spaces..." | |
| @read -p "Enter your HF username: " username; \ | |
| read -p "Enter space name: " space_name; \ | |
| python deploy_to_hf.py $$space_name $$username | |
| # Docker Compose targets | |
| up: | |
| docker-compose up -d | |
| down: | |
| docker-compose down | |
| restart: down up | |
| # Cleanup targets | |
| clean: stop | |
| -docker rmi $(IMAGE_NAME):$(VERSION) | |
| -docker system prune -f | |
| clean-all: clean | |
| -docker volume prune -f | |
| -docker network prune -f | |
| # Development workflow | |
| dev: install test build test-docker | |
| @echo "Development setup complete!" | |
| # Production workflow | |
| prod: clean build test-docker | |
| @echo "Production build complete!" | |
| # Quick start | |
| quick-start: build run-docker | |
| @echo "Quick start complete!" | |
| @echo "Waiting for server to be ready..." | |
| @sleep 5 | |
| @python test_mcp_server.py --server --url=http://localhost:$(PORT) | |
| # Health check | |
| health: | |
| @curl -f http://localhost:$(PORT)/ || echo "Server not responding" | |
| # Show running containers | |
| ps: | |
| docker ps --filter "name=$(CONTAINER_NAME)" | |
| # Show image info | |
| info: | |
| @echo "Image: $(IMAGE_NAME):$(VERSION)" | |
| @echo "Container: $(CONTAINER_NAME)" | |
| @echo "Port: $(PORT)" | |
| @docker images $(IMAGE_NAME) || echo "Image not built yet" | |