version: '3.8'

services:
  mysql:
    image: mysql:8.0
    container_name: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: ht
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    ports:
      - "3307:3306"
    volumes:
      - mysql_data:/var/lib/mysql

  mongodb:
    image: mongo:latest
    container_name: mongodb
    restart: always
    ports:
      - "27018:27017"
    volumes:
      - mongodb_data:/data/db

  nestjs:
    build: .
    container_name: nestjs
    ports:
      - "3000:3000"
    depends_on:
      - mysql
      - mongodb
    environment:
      MYSQL_URL: "mysql://root:rootpassword@mysql:3306/ht"
      MONGODB_URL: "mongodb://mongodb:27017/ht"
      PORT: 3000

volumes:
  mysql_data:
  mongodb_data:
