version: "3.7"

services:
  bot:
    image: node:20-alpine
    command: sh -c "npm config set cache /app/.npm_cache --global && npm install && npx sequelize db:migrate && node ."
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
    depends_on:
      - "mysql"
    working_dir: /app
    ports:
      - 127.0.0.1:${API_PORT}:${API_PORT}
    volumes:
      - ./:/app
      - /usr/share/fonts/:/usr/share/fonts/
  mysql:
      image: mysql:8.0
      restart: unless-stopped
      ports:
        - ${DB_PORT}:3306
      volumes:
        - ./data/db:/var/lib/mysql
      environment: 
        - TZ=Europe/Berlin
        - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
        - MYSQL_DATABASE=${DB_DATABASE}
        - MYSQL_USER=${DB_USERNAME}
        - MYSQL_PASSWORD=${DB_PASSWORD}
        - LANG=C.UTF-8
      command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci