version: '3.8'

services:
  auth-service:
    build: .
    container_name: metronet-auth
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_NAME=metronet_auth
      - DB_USER=root
      - DB_PASSWORD=${DB_PASSWORD}
      - JWT_SECRET=${JWT_SECRET}
      - JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET}
      - SMTP_USER=${SMTP_USER}
      - SMTP_PASS=${SMTP_PASS}
    volumes:
      - ./logs:/usr/src/app/logs
      - ./:/usr/src/app
      - /usr/src/app/node_modules
    depends_on:
      - mysql
    networks:
      - metronet-network
    restart: unless-stopped

  mysql:
    image: mysql:8.0
    container_name: metronet-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=metronet_auth
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - metronet-network
    restart: unless-stopped

volumes:
  mysql-data:
    driver: local

networks:
  metronet-network:
    driver: bridge 