services:
  bot:
    build:
      context: .
    volumes:
      - ./db:/db
    env_file:
      - .env
    environment:
      TZ: Europe/Moscow
      PENIS_DB_PATH: /db/penis_stats.sqlite3
      CHAT_HISTORY_DB_PATH: /db/chat_history.sqlite3
      POLYCHAETSI_STATS_PATH: /db/polychaetsi_stats.json
      BETS_DB_PATH: /db/bets.sqlite3
      ECONOMY_DB_PATH: /db/economy.sqlite3
      LLAMA_API_URL: ${LLAMA_API_URL:-https://mirror.porno4free.ru/zovos-ai/}
      LLAMA_FORCE_DISABLE_THINKING: ${LLAMA_FORCE_DISABLE_THINKING:-0}
      LLAMA_LOG_THINKING: ${LLAMA_LOG_THINKING:-1}
    init: true
    restart: unless-stopped

  webapp-api:
    build:
      context: .
      dockerfile: Dockerfile.api
    volumes:
      - ./db:/db
    env_file:
      - .env
    environment:
      TZ: Europe/Moscow
      PENIS_DB_PATH: /db/penis_stats.sqlite3
      CHAT_HISTORY_DB_PATH: /db/chat_history.sqlite3
      POLYCHAETSI_STATS_PATH: /db/polychaetsi_stats.json
      BET_DB_PATH: /db/bets.sqlite3
      API_PORT: "8080"
      LLAMA_API_URL: ${LLAMA_API_URL:-https://mirror.porno4free.ru/zovos-ai/}
      LLAMA_FORCE_DISABLE_THINKING: ${LLAMA_FORCE_DISABLE_THINKING:-0}
      LLAMA_LOG_THINKING: ${LLAMA_LOG_THINKING:-1}
    restart: unless-stopped

  webapp-frontend:
    build:
      context: ./webapp/frontend
    ports:
      - "${WEBAPP_HTTP_PORT:-80}:80"
      - "${WEBAPP_HTTPS_PORT:-443}:443"
    environment:
      APP_DOMAIN: ${APP_DOMAIN:-}
      APP_WWW_DOMAIN: ${APP_WWW_DOMAIN:-}
      ACME_EMAIL: ${ACME_EMAIL:-}
      CERTBOT_STAGING: ${CERTBOT_STAGING:-0}
      CERTBOT_RENEW_INTERVAL: ${CERTBOT_RENEW_INTERVAL:-12h}
    volumes:
      - certbot_etc:/etc/letsencrypt
      - certbot_www:/var/www/certbot
    depends_on:
      - webapp-api
    restart: unless-stopped

volumes:
  certbot_etc:
  certbot_www:
