version: '3.10'

services:
  db:
    image: mysql:8.0.33
    environment:
      MYSQL_DATABASE: 'db'
      MYSQL_USER: 'user'
      MYSQL_PASSWORD: 'password'
      MYSQL_ROOT_PASSWORD: 'aa123456'
    ports:
      - 3306:3306
    volumes:
      - my-db:/var/lib/mysql
    restart: unless-stopped
  webserver:
    build:
      context: .
      dockerfile: Dockerfile-webserver
    environment:
      - MODEL_SERVER=http://llmserver:8000
      - LOCAL_DB_HOST=db
      - WEB_SERVER_PORT=7860
    volumes:
      - ./models:/app/models
      - ./plugins:/app/plugins
      - data:/app/pilot/data
    env_file:
      - .env.template
    ports:
      - 7860:7860
    expose:
      - 7860
    restart: unless-stopped
  llmserver:
    build:
      context: .
      dockerfile: Dockerfile-llmserver
    environment:
      - LOCAL_DB_HOST=db
    volumes:
      - ./models:/app/models
    env_file:
      - .env.template
    ports:
      - 8000:8000
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids: ['1']
              capabilities: [gpu]



volumes:
  my-db:
  data:
