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
      # Utiliser un bind mount pour le cache pour éviter les problèmes de permissions
      - ./var/cache:/var/www/html/var/cache
      - php_log:/var/www/html/var/log
    environment:
      - APP_ENV=prod
      - APP_DEBUG=false
      - APP_URL=${APP_URL:-http://45.11.51.2:8084}
      - DATABASE_URL=mysql://3tek:ngamba123@database:3306/3tek?serverVersion=8.0&charset=utf8mb4
      - MAILER_DSN=smtp://noreply%40odoip.net:Ngamba%2D123@mail.odoip.net:465?encryption=ssl
      - TZ=Europe/Paris
    depends_on:
      - database
    networks:
      - app_network

  nginx:
    image: nginx:alpine
    container_name: 3tek_nginx
    ports:
      - "8084: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:-3tek}
      # You should definitely change the password in production
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-ngamba123}
      MYSQL_USER: ${MYSQL_USER:-3tek}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD:-ngamba123}
      TZ: Europe/Paris
    command: --default-time-zone='+01:00'
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      timeout: 5s
      retries: 5
      start_period: 60s
    ports:
      - "3309:3306"
    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_log:

networks:
  app_network:
    driver: bridge
