version: '3'

services:

    php:
        build:
            context: ./docker/php
        ports:
            - 9000:9000
        volumes:
            - ./:/srv/www/api
            - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
        environment:
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}

    nginx:
        image: nginx:1.13.8
        ports:
            - 80:80
        volumes:
            - ./:/srv/www/api
            - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
        depends_on:
            - php

    mysql:
        image: mysql:5.7
        ports:
            - 3306:3306
        depends_on:
            - php
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
