version: '3.8'
services:

  base:
    build:
      context: .
      dockerfile: ./deployment/nginx-php/base.Dockerfile
    image: "core/php-base:2.0.0"  # This defines the tag
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ./:/var/www

  web:
    build:
      context: .
      dockerfile: ./deployment/nginx-php/app.Dockerfile
      args:
        APP_ENV: ${APP_ENV:-local}
        XDEBUG: ${XDEBUG:-false}
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ./:/var/www
    ports:
      - ${WEB_LOCAL_PORT}:80
    depends_on:
      -   base

  redis:
    image: redis:latest
    platform: ${DOCKER_PLATFORM:-linux/amd64}
    command: redis-server --appendonly yes
    volumes:
      - redis-data:/data
    ports:
      - ${REDIS_LOCAL_PORT}:6379


  mysql:
     container_name: siddha.mysql9
     image: mysql:8.0
     command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
     environment:
         - MYSQL_ROOT_PASSWORD=root
         - MYSQL_DATABASE=${DOCKER_DB_DATABASE:-siddha}
         - MYSQL_USER=${DOCKER_DB_USERNAME:-siddha}
         - MYSQL_PASSWORD=${DOCKER_DB_PASSWORD:-siddha}
     ports:
         - ${DOCKER_DB_PORT}:3306
     volumes:
         - mysql-data:/var/lib/mysql
volumes:
  mysql-data:
  redis-data:
