version: '3.2'

services:
  db:
    image: gitlab.biig.fr:4567/french-american-foundation/frenchamerican-fr/mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    networks:
      - default

  front:
    image: gitlab.biig.fr:4567/french-american-foundation/frenchamerican-fr/front:latest
    env_file: .env.demo
    expose:
        - "8080"
    working_dir: /var/www/vhost/
    volumes:
        - ./:/var/www/vhost
        - ./docker/nginx/vhost.conf:/etc/nginx/sites-enabled/default:ro
    depends_on:
        - php-fpm
    labels:
        - "traefik.backend=backend_host_front_name"
        - "traefik.frontend.rule=Host:host_front"
        - "traefik.enable=true"
        - "traefik.port=8080"
        - "traefik.docker.network=exposed_world"
    networks:
        - exposed_world
        - default

  php-fpm:
    image: gitlab.biig.fr:4567/french-american-foundation/frenchamerican-fr/php-fpm:latest
    entrypoint: /docker-entrypoint.sh
    env_file: .env.demo
    working_dir: /var/www/vhost/
    volumes:
      - ./:/var/www/vhost
    networks:
      - default
    depends_on:
      - db

networks:
  default:
    driver: bridge
  exposed_world:
    external: true
