82 lines
1.9 KiB
YAML
82 lines
1.9 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Database Service
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: controlpatente-db
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
POSTGRES_DB: ${DB_NAME:-controlpatente}
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- backend-net
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Backend Service (Node.js)
|
|
backend:
|
|
build: ./backend
|
|
container_name: controlpatente-backend
|
|
environment:
|
|
- DATABASE_URL=postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@db:5432/${DB_NAME:-controlpatente}
|
|
- PORT=3000
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- backend-net
|
|
volumes:
|
|
- ./backend:/app
|
|
- /app/node_modules
|
|
|
|
# ALPR Component (Python + OpenCV)
|
|
alpr-service:
|
|
build: ./alpr-service
|
|
container_name: controlpatente-alpr
|
|
environment:
|
|
- BACKEND_URL=http://backend:3000
|
|
# On Mac, you usually cannot pass /dev/video0 directly.
|
|
# We might need to use a stream or just test with a file for now if direct access fails.
|
|
# For Linux/Raspberry Pi, the device mapping below is correct.
|
|
devices:
|
|
- "/dev/video0:/dev/video0"
|
|
networks:
|
|
- backend-net
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
# Add privilege for hardware access
|
|
privileged: true
|
|
|
|
# Frontend Service (React)
|
|
frontend:
|
|
build: ./frontend
|
|
container_name: controlpatente-frontend
|
|
ports:
|
|
- "5173:5173"
|
|
networks:
|
|
- backend-net
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
environment:
|
|
- VITE_API_URL=http://localhost:3000
|
|
|
|
networks:
|
|
backend-net:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
db_data:
|