version: '3.8'

services:
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: autonet-frontend
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - NEXT_PUBLIC_API_URL=http://192.168.0.202:8000
    depends_on:
      - backend
    restart: unless-stopped
    networks:
      - autonet-production

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: autonet-backend
    ports:
      - "8000:8000"
    environment:
      - ENV=production
    volumes:
      - ./backend/uploads:/app/uploads
      - backend-prod-data:/app/data
      - ./backend/.env:/app/.env:ro
    restart: unless-stopped
    networks:
      - autonet-production

  carmodoo-agent:
    build:
      context: ./agent
      dockerfile: Dockerfile
    container_name: carmodoo-agent
    environment:
      - ENV=production
    volumes:
      - agent-data:/app/data
      - agent-logs:/app/logs
    restart: unless-stopped
    networks:
      - autonet-production

networks:
  autonet-production:
    name: autonet-production-network

volumes:
  backend-prod-data:
    name: autonet-backend-prod-data
  agent-data:
    name: autonet-agent-data
  agent-logs:
    name: autonet-agent-logs
