version: "3.0"

services:

  mysql:
    image: mariadb:10.6
    volumes:
     - ./volumes/db:/var/lib/mysql
     - /etc/localtime:/etc/localtime:ro
    env_file:
     - .env
    restart: "always"
    expose:
     - "3306"

  php:
    build:
      context: Dockerfile-php
    volumes:
     - ./volumes/app:/var/www/html
     - /etc/localtime:/etc/localtime:ro
    links:
     - mysql
    depends_on:
     - mysql
    expose:
     - "9000"

  messenger:
    build:
      context: Dockerfile-php
    command: php /var/www/html/bin/console messenger:consume async --env=prod --time-limit=3600 --memory-limit=128M
    volumes:
     - ./volumes/app:/var/www/html
     - /etc/localtime:/etc/localtime:ro
    depends_on:
     - mysql
    restart: always

  nginx:
    image: nginx:1.17.4-alpine
    volumes:
      - ./volumes/app:/var/www/html
      - ./volumes/nginx-conf:/etc/nginx/conf.d
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - php
    links:
      - php
    ports:
      - 80:80
