ghostv1 / Dockerfile
Jagrut Thakare
v52
2534f78
FROM nvidia/cuda:11.2.2-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 nvidia-container-toolkit python3.9 python3.9-distutils python3-pip git wget && \
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 rm -rf ~/.cache
RUN pip install --user --no-cache-dir --upgrade pip
RUN pip install --user pydantic==2.8.2 gradio
RUN pip cache purge
RUN pip install --user torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu113
RUN python3 -m pip cache purge
RUN pip install --user --no-cache-dir mxnet onnxruntime-gpu==1.12 Cython requests==2.25.1 insightface==0.2.1 kornia==0.5.4 numpy==1.23.5 dill opencv-python onnx scikit-image wandb
RUN python3 -m pip cache purge
COPY --chown=user:user . .
RUN chmod +x download_models.sh
RUN ./download_models.sh
EXPOSE 7860
CMD ["python", "app.py"]