version: "3.8"
services:
    nodejs: # Service pour nodejs
        build:
            context: ./app
        volumes: 
          - ./app:/user/src/app

        ports:
            - "5000:5000"
        restart: unless-stopped

    nginx: # Service serveur web
        build:
            context: ./nginx
        volumes: 
          - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
        ports:
            - "8888:80"
        restart: unless-stopped

    mariadb: # Service base de données
      image: mariadb:latest
      env_file:
        - .env # fichier contenant les mot de passes
      environment:
        MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
#      expose:
#        - "3306"
      ports:
        - "3306:3306"
      volumes:
        - ./mariadb/mysql:/var/lib/mysql
        - ./mariadb:/docker-entrypoint-initdb.d
      command: --init-file /docker-entrypoint-initdb.d/rappaurio.sql 
      restart: unless-stopped
