Files
NYSM-NYD/docker-compose.yml

152 lines
3.7 KiB
YAML

version: '3.8'
services:
nowyouseeme:
build:
context: .
dockerfile: Dockerfile
target: runtime
container_name: nowyouseeme-app
ports:
- "8080:8080" # Main application port
- "8081:8081" # Device discovery port
- "8082:8082" # API port
volumes:
- ./config:/app/config:ro
- ./data:/app/data
- ./logs:/app/logs
environment:
- PYTHONPATH=/app/src
- NOWYOUSEE_DEBUG=0
- CUDA_VISIBLE_DEVICES=0
devices:
- /dev/video0:/dev/video0 # Camera access
- /dev/bus/usb:/dev/bus/usb # USB devices
network_mode: host # Required for WiFi CSI capture
restart: unless-stopped
healthcheck:
test: ["CMD", "python3", "-c", "import sys; sys.exit(0)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
nowyouseeme-dev:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: nowyouseeme-dev
ports:
- "8080:8080"
- "8081:8081"
- "8082:8082"
volumes:
- .:/app
- ./config:/app/config:ro
- ./data:/app/data
- ./logs:/app/logs
environment:
- PYTHONPATH=/app/src
- NOWYOUSEE_DEBUG=1
- CUDA_VISIBLE_DEVICES=0
devices:
- /dev/video0:/dev/video0
- /dev/bus/usb:/dev/bus/usb
network_mode: host
restart: unless-stopped
command: ["bash"]
# Optional: Redis for caching and session management
redis:
image: redis:7-alpine
container_name: nowyouseeme-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Optional: PostgreSQL for persistent data storage
postgres:
image: postgres:15-alpine
container_name: nowyouseeme-postgres
environment:
POSTGRES_DB: nowyouseeme
POSTGRES_USER: nowyouseeme
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nowyouseeme123}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nowyouseeme"]
interval: 30s
timeout: 10s
retries: 3
# Optional: Nginx for reverse proxy and load balancing
nginx:
image: nginx:alpine
container_name: nowyouseeme-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
depends_on:
- nowyouseeme
restart: unless-stopped
# Optional: Monitoring with Prometheus and Grafana
prometheus:
image: prom/prometheus:latest
container_name: nowyouseeme-prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
grafana:
image: grafana/grafana:latest
container_name: nowyouseeme-grafana
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin123}
volumes:
- grafana_data:/var/lib/grafana
depends_on:
- prometheus
restart: unless-stopped
volumes:
redis_data:
driver: local
postgres_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
networks:
default:
name: nowyouseeme-network
driver: bridge