version: '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}
    volumes:
       - db_data:/var/lib/mysql

  front:
    image: gitlab.biig.fr:4567/french-american-foundation/frenchamerican-fr/front:latest
    env_file: .env
    ports:
        - "${HTTPD_PORT}:8080"
        - "${STYLEGUIDE_PORT}:3333"
    working_dir: /var/www/vhost
    volumes:
        - ./:/var/www/vhost:delegated
        - ./docker/nginx/vhost.conf:/etc/nginx/sites-enabled/default:ro
    depends_on:
        - php-fpm

  php-fpm:
    image: gitlab.biig.fr:4567/french-american-foundation/frenchamerican-fr/php-fpm:latest
    ports:
      - ${PHP_FPM_PORT}:9000
    volumes:
      - ./:/var/www/vhost
    working_dir: /var/www/vhost
    depends_on:
      - db
    entrypoint: /docker-entrypoint.sh

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    ports:
      - ${PMA_PORT}:80
    environment:
      - PMA_HOST=${MYSQL_HOST}
      - PMA_USER=${MYSQL_USER}
      - PMA_PASSWORD=${MYSQL_PASSWORD}
    depends_on:
      - db

volumes:
  db_data:
