ghostv1 / Dockerfile
Jagrut Thakare
v42
6c30ecc
raw
history blame
1.28 kB
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
RUN pip install --user --no-cache-dir mxnet-cu112 onnxruntime-gpu==1.12 Cython requests==2.25.1 insightface==0.2.1 kornia==0.5.4 dill opencv-python onnx numpy scikit-image wandb
COPY --chown=user:user . .
RUN chmod +x download_models.sh
RUN ./download_models.sh
EXPOSE 7860
CMD ["python", "app.py"]