services:
  db:
    image: postgres:15-alpine
    container_name: knot-db
    restart: always
    env_file:
      - ../.env
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  server:
    build:
      context: ../backend
      dockerfile: Dockerfile
    container_name: knot-server
    restart: always
    env_file:
      - ../.env
    depends_on:
      - db
      - minio
      - mongo
    ports:
      - "5059:8080"

  minio:
    image: minio/minio
    container_name: knot-minio
    restart: always
    env_file:
      - ../.env
    ports:
      - "9000:9000"
      - "9001:9001"
    command: server /data --console-address ":9001"
    volumes:
      - minio_data:/data
  mongo:
    image: mongo:6-jammy
    container_name: knot-mongo
    restart: always
    ports:
      - "27017:27017"
    volumes:
      - mongo_data:/data/db

  web:
    build:
      context: ..
      dockerfile: client-web/Dockerfile
    container_name: knot-web
    restart: always
    ports:
      - "9090:80"
    env_file:
      - ../.env
    depends_on:
      - server

volumes:
  postgres_data:
  minio_data:
  mongo_data:
