File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # 1. Python 3.10 기반 슬림 이미지 사용
2- FROM python:3.10-slim
1+ # 1. 권장 베이스: CUDA 포함 PyTorch 런타임
2+ FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
3+
4+ # OpenCV 헤드리스 등에 필요한 OS 패키지
5+ RUN apt-get update && apt-get install -y --no-install-recommends \
6+ libglib2.0-0 libsm6 libxext6 libxrender1 && rm -rf /var/lib/apt/lists/*
7+
8+ # HF 캐시 + PyTorch 메모리 튜닝(선택)
9+ ENV HF_HOME=/models/hf-cache \
10+ HUGGINGFACE_HUB_CACHE=/models/hf-cache \
11+ PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
312
413# 2. 작업 디렉토리 생성
514WORKDIR /app
615
7- # 3. requirements.txt 먼저 복사하고 설치
16+ # 3. 의존성만 먼저 복사 → 캐시 최대 활용
817COPY everTale/requirements.txt ./requirements.txt
9- RUN pip install --no-cache-dir -r requirements.txt
18+ RUN pip install --no-cache-dir --upgrade pip \
19+ && pip install --no-cache-dir -r /app/requirements.txt \
20+ && pip install --no-cache-dir opencv-python-headless ultralytics
21+
22+ # 모델 파일을 이미지에 포함
23+ COPY models/yolov8n.pt /models/my_yolo_model.pt
24+ ENV YOLO_MODEL_PATH=/models/my_yolo_model.pt
1025
1126# 4. 전체 코드 복사
12- COPY . .
27+ COPY . /app
1328
1429# 5. 컨테이너가 열 포트 설정
1530EXPOSE 8000
You can’t perform that action at this time.
0 commit comments