room-visualizer / Dockerfile
Muhammad Usman Nazir
fix: update Dockerfile to use CUDA base image and install Python dependencies, adjust segmentation model in configuration
37b9169
FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
HF_HOME=/home/user/.cache/huggingface \
VISUALIZER_CONFIG=visualizer.hf.toml \
HOME=/home/user \
DEBIAN_FRONTEND=noninteractive
# Install Python and system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3.10 \
python3.10-venv \
python3-pip \
git \
ffmpeg \
libglib2.0-0 \
libgomp1 \
build-essential && \
ln -sf /usr/bin/python3.10 /usr/bin/python3 && \
ln -sf /usr/bin/python3 /usr/bin/python && \
rm -rf /var/lib/apt/lists/*
# Set up a new user named "user" with UID 1000 for Hugging Face permissions
RUN useradd -m -u 1000 user
WORKDIR /app
# Copy requirements files first
COPY requirements-base.txt requirements-gpu-cu126.txt ./
# Install CUDA PyTorch/Torchvision first, then other base requirements
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements-gpu-cu126.txt
# Copy the rest of the application files
COPY --chown=user:1000 . .
# Create writable data directories and change ownership
RUN mkdir -p data/uploads data/jobs && \
chown -R user:1000 /app
# Switch to the non-root user
USER user
# Hugging Face Spaces expects the application on port 7860
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]