version: '3.8'

services:
  bot:
    image: php:8.2-cli
    container_name: lastwar_bot
    restart: unless-stopped
    volumes:
      - ../lastwar:/var/www/html/lastwar
    working_dir: /var/www/html/lastwar
    command: /usr/local/bin/supervisord -c /var/www/html/lastwar/docker/supervisord.conf
    environment:
      - PHP_DISPLAY_ERRORS=On
      - PHP_ERROR_REPORTING=E_ALL
    networks:
      - bot_network
    depends_on:
      - db

  db:
    image: mysql:8.0
    container_name: lastwar_db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASS:-}
      MYSQL_DATABASE: ${DB_NAME:-bot}
    volumes:
      - db_data:/var/lib/mysql
      - ./db:/docker-entrypoint-initdb.d
    networks:
      - bot_network

  libretranslate:
    image: libretranslate/libretranslate
    container_name: lastwar_libretranslate
    restart: unless-stopped
    ports:
      - "5000:5000"
    networks:
      - bot_network

networks:
  bot_network:
    driver: bridge

volumes:
  db_data:
