services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    env_file:
      - .env
    container_name: slim_app
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - ./docker/vhost.conf:/etc/apache2/sites-enabled/000-default.conf
    command: /bin/sh -c "a2enmod rewrite && apache2-foreground"    
    depends_on:
      - db
    environment:
      DB_HOST: db
      DB_NAME: estagio_db
      DB_USER: user
      DB_PASS: password_secret

  db:
    image: mariadb:10.5
    container_name: mariadb_db
    restart: always
    environment:
      MARIADB_ROOT_PASSWORD: root_secret
      MARIADB_DATABASE: estagio_db
      MARIADB_USER: user
      MARIADB_PASSWORD: password_secret
    volumes:
      - db_data:/var/lib/mysql

  mailhog:
    image: mailhog/mailhog
    ports:
      - "1025:1025"
      - "8025:8025"

volumes:
  db_data: