1. 잘 돌아감
services:
  oms-server:
    container_name: oms-server
    build:
      # 프로젝트 루트를 context로 설정 (package.json이 있는 위치)
      context: ../../../
      dockerfile: standalone/docker/dockerfile/Dockerfile
    environment:
      - NODE_ENV=production
      - PROFILE=prod
      - PORT=${SERVER_PORT:-4577}
      - DB_HOST=oms-db # 내부 네트워크 접근
      - DB_PORT=5432     # 내부 네트워크 접근
      - DB_DB=${SERVER_POSTGRES_DB:-root}
      - DB_USER=${SERVER_POSTGRES_USER:-root}
      - DB_PASS=${SERVER_POSTGRES_PASS:-root}
    ports:
      - "${PORT:-4577}:${PORT:-4577}"
    depends_on:
      - oms-db
    networks:
      - oms-network
    restart: unless-stopped
    stop_grace_period: 3s
    logging:
      driver: "json-file"
      options:
        max-size: "20m"
        max-file: "5"

  oms-db:
    container_name: oms-db
    image: postgres:15.14-alpine
    environment:
      - POSTGRES_DB=${SERVER_POSTGRES_DB:-root}
      - POSTGRES_USER=${SERVER_POSTGRES_USER:-root}
      - POSTGRES_PASSWORD=${SERVER_POSTGRES_PASS:-root}
      - PGDATA=/var/lib/postgresql/data/pgdata # PGDATA 경로 설정
      - LC_ALL=ko_KR.utf8 # 로케일 설정
      - LANG=ko_KR.utf8
      - TZ=Asia/Seoul
    volumes:
      - v-oms-db-data:/var/lib/postgresql/data
      - ../../postgresql/initdb.d:/docker-entrypoint-initdb.d
    networks:
      - oms-network
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"

networks:
  oms-network:
    driver: bridge

volumes:
  v-oms-db-data: