stroke-segmentation-backend / docker-compose.yml
Mohamed424's picture
Initial commit - clean start for Hugging Face Space
0b5f282
Raw History Blame Contribute Delete
3.45 kB
version: '3.8'
services:
# Backend API Service
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: stroke-detection-api
ports:
- "8000:8000"
environment:
- MONGODB_URL=mongodb://mongo:27017
- DATABASE_NAME=stroke_detection
- CLOUDINARY_CLOUD_NAME=${CLOUDINARY_CLOUD_NAME}
- CLOUDINARY_API_KEY=${CLOUDINARY_API_KEY}
- CLOUDINARY_API_SECRET=${CLOUDINARY_API_SECRET}
volumes:
- ./backend/models:/app/models
- ./backend/logs:/app/logs
depends_on:
- mongo
restart: unless-stopped
networks:
- stroke-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend Service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: stroke-detection-frontend
ports:
- "80:80"
- "443:443"
depends_on:
- backend
restart: unless-stopped
networks:
- stroke-network
environment:
- REACT_APP_API_URL=http://localhost:8000
# MongoDB Service
mongo:
image: mongo:5.0
container_name: stroke-detection-mongo
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=password123
- MONGO_INITDB_DATABASE=stroke_detection
volumes:
- mongo_data:/data/db
- ./backend/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
networks:
- stroke-network
# Redis for Caching (Optional)
redis:
image: redis:7-alpine
container_name: stroke-detection-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
restart: unless-stopped
networks:
- stroke-network
command: redis-server --appendonly yes
# Nginx Load Balancer (Optional for production)
nginx:
image: nginx:alpine
container_name: stroke-detection-nginx
ports:
- "8080:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- frontend
- backend
restart: unless-stopped
networks:
- stroke-network
# Monitoring with Prometheus (Optional)
prometheus:
image: prom/prometheus:latest
container_name: stroke-detection-prometheus
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
restart: unless-stopped
networks:
- stroke-network
profiles:
- monitoring
# Grafana for Visualization (Optional)
grafana:
image: grafana/grafana:latest
container_name: stroke-detection-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin123
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources:ro
restart: unless-stopped
networks:
- stroke-network
profiles:
- monitoring
# Named Volumes
volumes:
mongo_data:
driver: local
redis_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
# Custom Network
networks:
stroke-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16