version: "3"
services:
  # Nginx server configuration
  web:
    image: nginx:1.17
    container_name: webserver
    depends_on:
      - db
      - php
    links:
      - db
      - php
    volumes:
      - .:/var/www/html/recomedcloud
      - ./devops/database-test.php:/var/www/html/recomedcloud/application/config/database.php
      - ./devops/constants-test.php:/var/www/html/recomedcloud/application/config/constants.php
      - ./nginx:/etc/nginx/conf.d/
    ports:
      - "80:80"
  # Php-fpm configuration
  php:
    build:
      context: .
      dockerfile: ./Dockerfile-php-testing
    image: php:8.3-fpm
    links:
      - db
    volumes:
      - .:/var/www/html/recomedcloud
      - ./devops/database-test.php:/var/www/html/recomedcloud/application/config/database.php
      - ./devops/constants-test.php:/var/www/html/recomedcloud/application/config/constants.php
      - ./devops/php-test.ini:/usr/local/etc/php/php.ini
  # Mysql configuration
  db:
    #image: mysql:5.7
    image: mariadb
    container_name: db
    restart: always
    command:
      [
        "--lower_case_table_names=1",
        "--innodb_page_size=64k",
        "--innodb_log_buffer_size=32M",
        "--innodb_buffer_pool_size=512M",
        "--sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",
      ]
    environment:
      - MYSQL_DATABASE=dedrhimy_recohelp
      - MYSQL_ALLOW_EMPTY_PASSWORD=true
      - MYSQL_ROOT_PASSWORD=
      - MYSQL_USER=tycho
      - MYSQL_PASSWORD=tycho
    #ports:
    #  - "3306:3306"
    # volumes:
    #   - ./dbdata:/var/lib/mysql
