version: '3'

services:
  php-fpm:
    build: ./docker/php-fpm
    container_name: scool-phpfrm-up
    volumes:
      - ${APP_PATH_HOST}/app:${APP_PATH_CONTAINER}
    working_dir: ${APP_PATH_CONTAINER}
    environment:
      XDEBUG_CONFIG: "remote_host=192.168.220.1 remote_enable=1"
      PHP_IDE_CONFIG: "serverName=Docker"
    networks:
      - internal

  node-js:
    build: ./docker/node-js
    container_name: scool-js-up
#        environment:
#            - APACHE_RUN_USER=#1000
    volumes:
      - ${APP_PATH_HOST}:${APP_PATH_CONTAINER}
    ports:
      - 8000:3000
      - 8001:3001
    working_dir: ${APP_PATH_CONTAINER}
    depends_on:
      - php-fpm
    stdin_open: true
    tty: true

  mysql:
    build:
      context: ./docker/mysql
    command: --default-authentication-plugin=mysql_native_password
    user: '1000'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: qwertynet
      MYSQL_DATABASE: dbsite
      MYSQL_USER: admin
      MYSQL_PASSWORD: user_password
    volumes:
      - ./source/dbase:/var/lib/mysql
    ports:
      - "3306"
    depends_on:
      - php-fpm

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    depends_on:
        - mysql
    environment:
        - PMA_ARBITRARY=1
    restart: always
    ports:
        - 8080:80
    volumes:
        - /session

  # adminer:
  #   image: adminer
  #   restart: always
  #   ports:
  #     - 8080:8080

  nginx:
    build:
      context: docker/nginx
    volumes:
      - ${APP_PATH_HOST}/app:${APP_PATH_CONTAINER}
    ports:
      - "80:80"
    depends_on:
      - php-fpm
    networks:
      - internal

networks:
  internal:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 192.168.220.0/28
