version: '3'

services:
  nginx:
    image: nginx:latest
    container_name: slim4-api-skeleton-nginx-container
    ports:
      - "8081:80"
    volumes:
      - ./:/var/www/html
      - ./docker/nginx/conf.d:/etc/nginx/conf.d
    depends_on:
      - php-fpm

  php-fpm:
    build: ./docker/php7
    container_name: slim4-api-skeleton-php-container
    links:
      - mysql
    environment:
      - PHP_FPM_ENABLE=1
      - PHP_FPM_SERVER_ADDR=php
      - PHP_FPM_SERVER_PORT=9000
      - PHP_FPM_TIMEOUT=${HTTPD_TIMEOUT_TO_PHP_FPM:-180}
      - DB_HOST=mysql
      - DB_NAME=slim4_api_skeleton
      - DB_USER=root
      - DB_PASS=
      - DB_PORT=3306

    volumes:
     - ./:/var/www/html

  mysql:
    image: mysql:5.7
    ports:
      - 33060:3306
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_DATABASE: slim4_api_skeleton
      MYSQL_USER: root
      MYSQL_PASSWORD: 
      MYSQL_ROOT_PASSWORD: 
    volumes:
      - my-data:/var/lib/mysql

volumes:
  my-data:
