bone_2026/Dockerfile_cuda

77 lines
2.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DXA Quality Assessment - Docker Container (GPU / CUDA)
# Build: docker build -t dxa-quality .
# Run: docker run --gpus all -v /path/to/data:/data -p 8000:8000 dxa-quality
# Base image with GPU support
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
# Неинтерактивный режим для apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
python3.10-dev \
python3.10-venv \
build-essential \
ninja-build \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Обновляем pip и ставим свежий meson (0.64.0+) — ДО всех Python-пакетов
RUN pip3 install --no-cache-dir --upgrade pip "meson>=0.64.0"
WORKDIR /app
# --- PyTorch под CUDA 11.8 (ставим отдельно, чтобы не тянулся CUDA 12.6) ---
RUN pip3 install --no-cache-dir \
torch==2.8.0 torchvision==0.23.0 \
--index-url https://download.pytorch.org/whl/cu118
# --- Остальные зависимости ---
# Ставим с явными ограничениями, чтобы pip разрешил конфликты
RUN pip3 install --no-cache-dir \
fastapi==0.128.8 \
"uvicorn[standard]==0.39.0" \
monai==1.5.2 \
TotalSegmentator==2.18.0 \
nibabel==5.3.3 \
pydicom==2.4.4 \
pydicom-seg==0.4.1 \
opencv-python-headless==4.11.0.86 \
scikit-learn==1.6.1 \
scipy==1.13.1 \
pandas==2.3.3 \
numpy==1.26.4 \
openpyxl==3.1.5 \
matplotlib==3.9.4 \
timm==1.0.29 \
python-multipart==0.0.20 \
pydantic==2.13.4 \
typer==0.23.2 \
click==8.2.1 \
huggingface_hub==1.8.0 \
safetensors==0.7.0 \
simpleitk==2.5.6 \
tqdm==4.70.0 \
rich==15.0.0 \
PyYAML==6.0.3
# Copy application code
COPY . .
RUN mkdir -p models
# Expose API port
EXPOSE 8000
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# Default command
CMD ["python3", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]