services:
  #nginx webserver + php 8.x
  web:
    build:
      context: .
      dockerfile: ./docker/nginx/Dockerfile
    ports:
      - "9090:80"
    depends_on:
      - db
    volumes:
      - ./local-instances/${LOCAL_INSTANCE_NAME:-0}/www:/var/www/html
      - ./docker/nginx/vichan.conf:/etc/nginx/conf.d/default.conf
      - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./docker/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
    links:
      - php

  php:
    build:
      context: .
      dockerfile: ./docker/php/Dockerfile
    volumes:
      - ./local-instances/${LOCAL_INSTANCE_NAME:-0}/www:/var/www
      - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
      - ./docker/php/jit.ini:/usr/local/etc/php/conf.d/jit.ini

  #MySQL Service
  db:
    image: mysql:8.0.35
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: vichan
      MYSQL_ROOT_PASSWORD: password
    volumes:
      - ./local-instances/${LOCAL_INSTANCE_NAME:-0}/mysql:/var/lib/mysql
