networks:
  symfony:
    name: symfony

volumes:
  build_dir:
    driver: local
  bundles_dir:
    driver: local
  node_modules:
    driver: local
  vendor:
    driver: local

services:
  nginx:
    image: nginx:alpine
    container_name: streamer_nginx
    restart: unless-stopped
    volumes:
      - ./.docker/${APP_ENV}/nginx.conf:/etc/nginx/conf.d/default.conf:ro
      - /var/log/nginx/healthd:/var/log/nginx/healthd:rw
      - ./public:/var/app/current/public
      - build_dir:/var/app/current/public/build
      - bundles_dir:/var/app/current/public/bundles
    ports:
      - 80:80
    depends_on:
      - symfony
    networks:
      - symfony

  symfony:
    build:
      context: .
      target: prod
      args:
        - BUILD_ARGUMENT_ENV:${APP_ENV}
        - BUILD_ARGUMENT_TIMEZONE:${APP_TIMEZONE_CLIENT}
    container_name: streamer_symfony
    volumes:
      - ./.env.local:/var/app/current/.env.local:ro
      - ./.docker/general/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf
      - ./.docker/general/cron:/var/spool/cron/crontabs/root
      - build_dir:/var/app/current/public/build
      - bundles_dir:/var/app/current/public/bundles
    expose:
      - '9000'
    networks:
      - symfony

  supervisord:
    build:
      context: .
      target: supervisor
    container_name: streamer_supervisord
    volumes:
      - ./.env.local:/var/app/current/.env.local:ro
      - ./.docker/general/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf
      - ./.docker/general/cron:/var/spool/cron/crontabs/root
      - build_dir:/var/app/current/public/build
      - bundles_dir:/var/app/current/public/bundles
    expose: []
    command: ['/usr/bin/supervisord']
    networks:
      - symfony
