|
|
|
FROM nvcr.io/nvidia/pytorch:23.10-py3
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app \
|
|
HUGGINGFACE_HUB_CACHE=/app/cache \
|
|
HF_HOME=/app/cache \
|
|
HF_HUB_ENABLE_HF_TRANSFER=1 \
|
|
PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 \
|
|
TORCH_CUDA_ARCH_LIST="7.5 8.0 8.6+PTX" \
|
|
FORCE_CUDA="1"
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git \
|
|
libgl1-mesa-glx \
|
|
libglib2.0-0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
RUN mkdir -p /app/cache
|
|
|
|
|
|
COPY requirements.txt .
|
|
|
|
|
|
RUN pip install --no-cache-dir -U pip setuptools wheel && \
|
|
pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cu118 && \
|
|
pip install --no-cache-dir xformers --index-url https://download.pytorch.org/whl/cu118
|
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
COPY app.py .
|
|
|
|
|
|
EXPOSE 7860
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:7860 || exit 1
|
|
|
|
|
|
CMD ["python", "app.py"] |