Gaze-LLE / Dockerfile
fffiloni's picture
Update Dockerfile
c813a1c verified
raw
history blame
2.08 kB
# Use the NVIDIA CUDA runtime as a base image
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
CUDA_HOME=/usr/local/cuda \
PATH=/home/user/.local/bin:$PATH \
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
GRADIO_SHARE=False \
SYSTEM=spaces
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Install system dependencies as root
USER root
# Install basic utilities and Python 3.9
RUN apt-get update && apt-get install -y \
wget \
curl \
git \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa -y && \
apt-get update && apt-get install -y \
python3.9 \
python3.9-distutils \
python3.9-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install pip for Python 3.9
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9
# Set Python 3.9 as the default Python version
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 && \
update-alternatives --config python <<< '1' && \
update-alternatives --config python3 <<< '1'
# Verify Python and pip versions
RUN python --version && pip --version
USER user
# Copy dependencies and install them via pip
COPY . .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install gradio
USER root
# Configure git to trust the directory
RUN git config --global --add safe.directory /home/user/app
RUN chown -R user:user /home/user/app
USER user
# Set the environment variable to specify the GPU device
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
ENV CUDA_VISIBLE_DEVICES=0
# Command to run your application
CMD ["python", "app.py"]