Files
drone-detector/docker-compose.simple.yml
2025-08-16 19:56:12 +02:00

131 lines
3.1 KiB
YAML

version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: drone-detection-db
restart: unless-stopped
environment:
POSTGRES_DB: drone_detection
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres123
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5433:5432"
networks:
- drone-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d drone_detection"]
interval: 30s
timeout: 10s
retries: 3
# Redis for session management and caching
redis:
image: redis:7-alpine
container_name: drone-detection-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
ports:
- "6380:6379"
networks:
- drone-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Backend API Server
backend:
build:
context: ./server
dockerfile: Dockerfile
container_name: drone-detection-backend
restart: unless-stopped
environment:
NODE_ENV: production
PORT: 3001
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: drone_detection
DB_USER: postgres
DB_PASSWORD: postgres123
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:-your-super-secret-jwt-key-change-in-production}
TWILIO_ACCOUNT_SID: ${TWILIO_ACCOUNT_SID}
TWILIO_AUTH_TOKEN: ${TWILIO_AUTH_TOKEN}
TWILIO_PHONE_NUMBER: ${TWILIO_PHONE_NUMBER}
CORS_ORIGIN: http://localhost:3000
ports:
- "3001:3001"
volumes:
- ./server/logs:/app/logs
networks:
- drone-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3002/api/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend React Application
frontend:
build:
context: ./client
dockerfile: Dockerfile
args:
VITE_API_URL: http://localhost:3002/api
VITE_WS_URL: ws://localhost:3002
container_name: drone-detection-frontend
restart: unless-stopped
ports:
- "3001:80"
networks:
- drone-network
depends_on:
- backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
# Python Drone Simulator (Optional)
simulator:
build:
context: .
dockerfile: docker/simulator/Dockerfile
container_name: drone-detection-simulator
restart: "no"
environment:
API_URL: http://backend:3002/api
networks:
- drone-network
depends_on:
- backend
profiles:
- simulation
command: python drone_simulator.py --api-url http://backend:3002/api --devices 5 --duration 3600
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
drone-network:
driver: bridge