# GPU 환경을 위한 Dockerfile FROM nvidia/cuda:11.8-devel-ubuntu20.04 # 환경 변수 설정 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV CUDA_VISIBLE_DEVICES=0 # 시스템 패키지 업데이트 및 설치 RUN apt-get update && apt-get install -y \ python3.9 \ python3.9-dev \ python3-pip \ git \ wget \ curl \ build-essential \ libgl1-mesa-glx \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Python 3.9을 기본으로 설정 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 # 작업 디렉토리 설정 WORKDIR /app # Python 의존성 파일 복사 COPY requirements.txt . # Python 패키지 설치 RUN pip3 install --no-cache-dir -r requirements.txt # GPU 관련 패키지 설치 RUN pip3 install --no-cache-dir \ torch==2.0.1+cu118 \ torchvision==0.15.2+cu118 \ torchaudio==2.0.2+cu118 \ --index-url https://download.pytorch.org/whl/cu118 # 프로젝트 파일 복사 COPY . . # 포트 설정 EXPOSE 8001 # 헬스체크 추가 HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8001/health || exit 1 # 실행 명령 CMD ["python3", "run_server_v2.py"]