version: '3.8'

services:
  app:
    build:
        context: ../forum-project
        dockerfile: Dockerfile
    container_name: php_app
    ports:
        - "8080:80"
    volumes:
      - ../forum-project:/var/www/html
    env_file:
      - .env


    depends_on:
        - mysql

  mysql:
    image: mysql:8.1
    container_name: mysql_container
    restart: always
    ports:
      - "${MYSQL_PORT}:3306"
    env_file:
      - .env
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
      - ./setup-mysql:/docker-entrypoint-initdb.d


  minio:
    image: minio/minio:latest
    container_name: minio_container
    restart: always
    ports:
      - "${MINIO_PORT}:9000"
      - "${MINIO_CONSOLE_PORT}:9001"
    env_file:
      - .env
    environment:
      MINIO_ROOT_USER: ${MINIO_ROOT_USER}
      MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
    command: server /data --console-address ":${MINIO_CONSOLE_PORT}"
    volumes:
      - minio_data:/data

  minio-init:
    image: minio/mc:latest
    depends_on:
      - minio
    env_file:
      - .env
    volumes:
      - ./setup-minio/init-minio.sh:/init-minio.sh
    entrypoint: [ "/bin/sh", "/init-minio.sh" ]

volumes:
  mysql_data:
  minio_data:


