Deepseek-OCR 환경 설정
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
# 1. vLLM 호환을 위해 NVIDIA CUDA 베이스 이미지 선택
|
||||
# 참고: vLLM 버전에 따라 적절한 CUDA 버전을 선택해야 할 수 있습니다.
|
||||
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
|
||||
# PyTorch 2.6.0 + CUDA 12.6 + cuDNN9
|
||||
FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel
|
||||
|
||||
# 2. 환경 변수 설정 및 기본 패키지 설치
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3.9 \
|
||||
python3.9-pip \
|
||||
git \
|
||||
# 기본 환경 변수 설정
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
HF_HOME=/workspace/.cache/huggingface \
|
||||
CUDA_HOME=/usr/local/cuda \
|
||||
LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH} \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas \
|
||||
TORCH_CUDA_ARCH_LIST="8.0"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# 필수 빌드 도구 설치
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git build-essential ninja-build \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# python3.9을 기본 python/pip으로 설정
|
||||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 && \
|
||||
update-alternatives --install /usr/bin/pip pip /usr/bin/pip 1
|
||||
# pip 업그레이드
|
||||
RUN python -m pip install -U pip setuptools wheel
|
||||
|
||||
# 3. 작업 디렉토리 설정
|
||||
WORKDIR /app
|
||||
# 기존 라이브러리 제거 및 특정 버전 재설치
|
||||
RUN pip uninstall -y vllm torch torchvision torchaudio triton flash-attn || true
|
||||
RUN pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0
|
||||
|
||||
# 4. 소스 코드 및 의존성 파일 복사
|
||||
# (main.py, requirements.txt, deepseek_ocr.py, process/, config.py 등 모든 파일)
|
||||
COPY . .
|
||||
# 프로젝트 의존성 설치
|
||||
COPY requirements.txt /tmp/requirements.txt
|
||||
RUN pip install -r /tmp/requirements.txt
|
||||
|
||||
# 5. Python 의존성 설치
|
||||
# vLLM은 torch를 필요로 하므로 함께 설치합니다.
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# vLLM 특정 버전 설치
|
||||
RUN pip install vllm==0.8.5
|
||||
|
||||
# 6. 서비스 포트 노출
|
||||
EXPOSE 8000
|
||||
# FlashAttention 소스에서 빌드하여 설치
|
||||
RUN pip cache purge && \
|
||||
pip install --no-cache-dir --no-build-isolation --no-binary=flash-attn flash-attn==2.7.3
|
||||
|
||||
# 7. FastAPI 서버 실행
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
WORKDIR /workspace
|
||||
Reference in New Issue
Block a user