Spaces:
Runtime error
Runtime error
phongtran
commited on
Commit
·
e52b734
1
Parent(s):
6b76fb8
first
Browse files- Dockerfile +24 -23
Dockerfile
CHANGED
|
@@ -1,30 +1,30 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
| 9 |
-
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
| 10 |
-
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
git \
|
| 19 |
-
ffmpeg \
|
| 20 |
-
nvidia-container-toolkit \
|
| 21 |
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
COPY ./requirements.txt /code/requirements.txt
|
| 26 |
-
|
| 27 |
-
# Set up a new user named "user" with user ID 1000
|
| 28 |
RUN useradd -m -u 1000 user
|
| 29 |
# Switch to the "user" user
|
| 30 |
USER user
|
|
@@ -33,11 +33,12 @@ ENV HOME=/home/user \
|
|
| 33 |
PATH=/home/user/.local/bin:$PATH \
|
| 34 |
PYTHONPATH=$HOME/app \
|
| 35 |
PYTHONUNBUFFERED=1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
SYSTEM=spaces
|
| 37 |
|
| 38 |
-
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 39 |
-
|
| 40 |
-
# Set the working directory to the user's home directory
|
| 41 |
WORKDIR $HOME/app
|
| 42 |
|
| 43 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
|
|
|
| 1 |
+
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
|
| 2 |
+
FROM nvidia/cuda:${CUDA_IMAGE}
|
| 3 |
|
| 4 |
+
# We need to set the host to 0.0.0.0 to allow outside access
|
| 5 |
+
ENV HOST 0.0.0.0
|
| 6 |
|
| 7 |
+
RUN apt-get update && apt-get upgrade -y \
|
| 8 |
+
&& apt-get install -y git build-essential \
|
| 9 |
+
python3 python3-pip gcc wget \
|
| 10 |
+
ocl-icd-opencl-dev opencl-headers clinfo \
|
| 11 |
+
libclblast-dev libopenblas-dev \
|
| 12 |
+
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
|
| 13 |
|
| 14 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
# setting build related env vars
|
| 17 |
+
ENV CUDA_DOCKER_ARCH=all
|
| 18 |
+
ENV LLAMA_CUBLAS=1
|
| 19 |
|
| 20 |
+
# Install depencencies
|
| 21 |
+
RUN python3 -m pip install --upgrade pip pytest cmake \
|
| 22 |
+
scikit-build setuptools fastapi uvicorn sse-starlette \
|
| 23 |
+
pydantic-settings starlette-context gradio huggingface_hub hf_transfer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# Install llama-cpp-python (build with cuda)
|
| 26 |
+
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
RUN useradd -m -u 1000 user
|
| 29 |
# Switch to the "user" user
|
| 30 |
USER user
|
|
|
|
| 33 |
PATH=/home/user/.local/bin:$PATH \
|
| 34 |
PYTHONPATH=$HOME/app \
|
| 35 |
PYTHONUNBUFFERED=1 \
|
| 36 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 37 |
+
GRADIO_NUM_PORTS=1 \
|
| 38 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 39 |
+
GRADIO_THEME=huggingface \
|
| 40 |
SYSTEM=spaces
|
| 41 |
|
|
|
|
|
|
|
|
|
|
| 42 |
WORKDIR $HOME/app
|
| 43 |
|
| 44 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|