
services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: 3tek_php
    volumes:
      - .:/var/www/html
      # Volumes nommés pour améliorer les performances sur Windows
      - php_vendor:/var/www/html/vendor
      - php_cache:/var/www/html/var/cache
      - php_log:/var/www/html/var/log
    environment:
      - APP_ENV=${APP_ENV:-dev}
      - DATABASE_URL=${DATABASE_URL}
      - TZ=Europe/Paris
    depends_on:
      - database
    networks:
      - app_network

  nginx:
    image: nginx:alpine
    container_name: 3tek_nginx
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
    networks:
      - app_network

###> doctrine/doctrine-bundle ###
  database:
    image: mysql:${MYSQL_VERSION:-8.0}
    environment:
      MYSQL_DATABASE: ${MYSQL_DATABASE:-app}
      # You should definitely change the password in production
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-!ChangeMe!}
      MYSQL_USER: ${MYSQL_USER:-app}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD:-!ChangeMe!}
      TZ: Europe/Paris
    command: --default-time-zone='+01:00'
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      timeout: 5s
      retries: 5
      start_period: 60s
    volumes:
      - database_data:/var/lib/mysql:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/mysql:rw
    networks:
      - app_network
###< doctrine/doctrine-bundle ###

volumes:
###> doctrine/doctrine-bundle ###
  database_data:
###< doctrine/doctrine-bundle ###
  # Volumes pour améliorer les performances sur Windows
  php_vendor:
  php_cache:
  php_log:

networks:
  app_network:
    driver: bridge
