upscalev1 / Dockerfile
torinriley's picture
Switch to CUDA base image + cu121 torch to use GPU
b095bac
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
OMP_NUM_THREADS=1
# Python 3.10 (Ubuntu 22.04 default) is fine — basicsr locals() bug is 3.13+ only
RUN apt-get update && apt-get install -y \
python3 python3-pip python3-dev \
ffmpeg libsm6 libxext6 libgl1 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3 /usr/bin/python
# Install torch with CUDA 12.1 support (compatible with CUDA 12.x hosts)
RUN pip3 install --no-cache-dir \
torch torchvision \
--index-url https://download.pytorch.org/whl/cu121
WORKDIR /app
COPY . .
# Install basicsr from vendored patched source
RUN pip3 install --no-cache-dir ./basicsr_vendor
RUN pip3 install --no-cache-dir \
"realesrgan>=0.3.0" \
"opencv-python-headless>=4.8.0" \
"numpy>=1.24.0" \
"Pillow>=10.0.0" \
tqdm \
"gradio_imageslider>=0.0.20" \
"gradio==6.8.0"
RUN useradd -m -u 1000 user && chown -R user:user /app
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
EXPOSE 7860
CMD ["python3", "app.py"]