Spaces:
Running
Running
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
PYTHONUNBUFFERED=1 \ | |
GRADIO_SERVER_NAME="0.0.0.0" \ | |
HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Install Python 3.9 and git | |
RUN apt-get update && \ | |
apt-get install -y ffmpeg python3.9 python3.9-distutils python3-pip git && \ | |
rm -rf /var/lib/apt/lists/* | |
# Make python3.9 default | |
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 && \ | |
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 | |
# Create non-root user and fix permissions | |
RUN useradd -m -u 1000 user && \ | |
mkdir -p /home/user/.local && \ | |
chown -R user:user /home/user | |
USER user | |
WORKDIR /home/user/app | |
# Copy files and install only Gradio | |
COPY --chown=user:user . /home/user/app | |
RUN pip install --user pydantic==2.8.2 gradio | |
RUN pip install --user torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | |
EXPOSE 7860 | |
CMD ["python", "app.py"] | |