version: "3.7"
services:
  web-server:
    build:
      dockerfile: Dockerfile
      context: .
    restart: always
    volumes:
      - "./:/var/www/html/TCGEngine:Z"
    command: bash "/var/www/html/TCGEngine/docker-entrypoint.sh"
    ports:
      - "3100:80"
    depends_on:
      - redis
      - mysql-server
    environment:
      PHP_FPM_CLEAR_ENV: "no"
      MYSQL_ROOT_PASSWORD: "secret"
      MYSQL_SERVER_NAME: "mysql-server"
      MYSQL_SERVER_USER_NAME: "root"
      REDIS_HOST: "app_redis"
      REDIS_ENABLED: true
      DOMAIN: "${DOMAIN:-localhost}"
      STAGE: "${STAGE:-prod}"
    user: "${DOCKER_USER}"

  mysql-server:
    image: mysql:latest
    restart: always
    environment:
      PHP_FPM_CLEAR_ENV: "no"
      MYSQL_ROOT_PASSWORD: "secret"
      MYSQL_SERVER_NAME: "mysql-server"
      MYSQL_SERVER_USER_NAME: "root"
      MYSQL_DATABASE: "swuonline"
    volumes:
      - ./Database:/docker-entrypoint-initdb.d
  phpmyadmin:
    image: phpmyadmin:latest
    restart: always
    environment:
      PMA_HOST: mysql-server
      PMA_USER: root
      PMA_PASSWORD: "secret"
    ports:
      - "5101:80"
  redis:
    image: redis:7.0
    container_name: swustats_app_redis
    ports:
      - "6482:6379"
volumes:
  mysql-data:
