

services:
  db:
    image: mysql:8.0
    container_name: rup-db
    restart: always
    ports:
      - "3306:3306"
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: rup159632
      MYSQL_DATABASE: rup_db
      MYSQL_USER: rup_user
      MYSQL_PASSWORD: rup159632
      TZ: UTC
    volumes:
      - ./mysql_data:/var/lib/mysql
    networks:
      - rup-network

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: rup-backend
    restart: always
    ports:
      - "3000:3000"

    env_file:
      - ./backend/.env.production
    depends_on:
      - db
    networks:
      - rup-network

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: rup-frontend
    restart: always
    ports:
      - "80:80"

# NPM과 통신하기 위한 외부 네트워크 정의
networks:
  rup-network:
    driver: bridge
