version: "2"
services:
  php:
    container_name: book_php
    build: .
    tty: true
    working_dir: /var/www/book
    #command: composer install
    volumes:
      - ../:/var/www/book
      - ./Config.neon:/var/www/book/app/Config/Config.neon
      - ./php.ini:/usr/local/etc/php/php.ini
      - ./www.conf:/usr/local/etc/php-fpm.d/www.conf
  nginx:
    image: nginx
    container_name: book_nginx
    ports:
      #- "8880:80"
      - "80:80"
      - "443:443"
    links:
      - php
      - mysql
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./default.conf:/etc/nginx/conf.d/default.conf
      - ../:/var/www/book
  mysql:
    container_name: book_mysql
    image: mysql:8.0.29
    ports:
      #- "33061:3306"
      #- "3306:3306"
      - "3307:3306"
    volumes:
      - ./my.cnf:/etc/mysql/conf.d/my.cnf
      - book-project-data:/var/lib/mysql
      - ../:/var/www/book
    command: >
      bash -c "
      chmod 644 /etc/mysql/conf.d/*.cnf
      && /entrypoint.sh mysqld
      "
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_DATABASE: book
      MYSQL_USER: book
      MYSQL_PASSWORD: book
  elasticsearch:
    image: elasticsearch:7.13.4
    container_name: book_elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - "9200:9200"
      - "9300:9300"

volumes:
  book-project-data:
