version: '3'
services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx
    ports:
      - '127.0.0.1:3000:80'
      - '127.0.0.1:3002:443'
    volumes:
      - ./docker/hosts:/etc/nginx/conf.d
      - .:/var/www/pet_help
      - ./docker/logs:/var/log/nginx
    links:
      - php
      - mysql
  php:
    build: ./docker/images/php
    container_name: php
    links:
      - mysql:stable-alpine
    volumes:
      - .:/var/www/pet_help
    environment:
      COMPOSER_AUTH: ${COMPOSER_AUTH}
  mysql:
    restart: always
    image: mysql:latest
    command: --init-file /data/application/init.sql
    environment:
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
    volumes:
      - ./docker/database/init.sql:/data/application/init.sql
      - ./docker/db-data:/var/lib/mysql
volumes:
    pet_help-volume:
