Spaces:
Runtime error
Runtime error
uv docker
Browse files- Dockerfile +16 -4
- server/requirements.txt +16 -12
Dockerfile
CHANGED
|
@@ -20,24 +20,36 @@ WORKDIR /code
|
|
| 20 |
|
| 21 |
RUN mkdir -p /etc/apt/keyrings
|
| 22 |
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
|
|
| 23 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
| 24 |
RUN apt-get update && apt-get install nodejs -y
|
| 25 |
|
| 26 |
-
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Set up a new user named "user" with user ID 1000
|
| 29 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Switch to the "user" user
|
| 31 |
USER user
|
|
|
|
| 32 |
# Set home to the user's home directory
|
| 33 |
ENV HOME=/home/user \
|
| 34 |
-
PATH=/home/user/.local/bin:$PATH \
|
| 35 |
PYTHONPATH=$HOME/app \
|
| 36 |
PYTHONUNBUFFERED=1 \
|
| 37 |
SYSTEM=spaces
|
| 38 |
|
| 39 |
-
RUN pip3 install --no-cache-dir --upgrade --pre -r /code/requirements.txt
|
| 40 |
-
|
| 41 |
# Set the working directory to the user's home directory
|
| 42 |
WORKDIR $HOME/app
|
| 43 |
|
|
|
|
| 20 |
|
| 21 |
RUN mkdir -p /etc/apt/keyrings
|
| 22 |
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
| 23 |
+
|
| 24 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
| 25 |
RUN apt-get update && apt-get install nodejs -y
|
| 26 |
|
| 27 |
+
COPY ./server/requirements.txt /code/requirements.txt
|
| 28 |
+
|
| 29 |
+
# Download and install UV
|
| 30 |
+
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
| 31 |
+
RUN chmod +x /uv-installer.sh && \
|
| 32 |
+
/uv-installer.sh && \
|
| 33 |
+
rm /uv-installer.sh
|
| 34 |
+
|
| 35 |
+
ENV PATH="/root/.local/bin:$PATH"
|
| 36 |
|
| 37 |
# Set up a new user named "user" with user ID 1000
|
| 38 |
RUN useradd -m -u 1000 user
|
| 39 |
+
|
| 40 |
+
# Install dependencies using UV as root
|
| 41 |
+
RUN uv pip install --no-cache --system --index-strategy=unsafe-best-match -r /code/requirements.txt
|
| 42 |
+
|
| 43 |
# Switch to the "user" user
|
| 44 |
USER user
|
| 45 |
+
|
| 46 |
# Set home to the user's home directory
|
| 47 |
ENV HOME=/home/user \
|
| 48 |
+
PATH=/home/user/.local/bin:/root/.local/bin:$PATH \
|
| 49 |
PYTHONPATH=$HOME/app \
|
| 50 |
PYTHONUNBUFFERED=1 \
|
| 51 |
SYSTEM=spaces
|
| 52 |
|
|
|
|
|
|
|
| 53 |
# Set the working directory to the user's home directory
|
| 54 |
WORKDIR $HOME/app
|
| 55 |
|
server/requirements.txt
CHANGED
|
@@ -1,13 +1,8 @@
|
|
| 1 |
-
--
|
| 2 |
-
torch==2.5.1
|
| 3 |
-
torchvision
|
| 4 |
-
torchaudio
|
| 5 |
-
xformers; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 6 |
numpy
|
| 7 |
diffusers
|
| 8 |
llvmlite>=0.39.0
|
| 9 |
numba>=0.56.0
|
| 10 |
-
pruna[stable-fast] ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 11 |
transformers
|
| 12 |
pydantic
|
| 13 |
huggingface-hub
|
|
@@ -18,18 +13,27 @@ Pillow==11.0.0
|
|
| 18 |
accelerate
|
| 19 |
compel==2.0.2
|
| 20 |
controlnet-aux==0.0.9
|
| 21 |
-
peft
|
| 22 |
markdown2
|
| 23 |
safetensors
|
| 24 |
-
# stable_fast @ https://github.com/chengzeyi/stable-fast/releases/download/nightly/stable_fast-1.0.5.dev20241127+torch230cu121-cp310-cp310-manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 25 |
-
#oneflow @ https://github.com/siliconflow/oneflow_releases/releases/download/community_cu121/oneflow-0.9.1.dev20241114%2Bcu121-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 26 |
-
#onediff @ git+https://github.com/siliconflow/onediff.git@main#egg=onediff ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 27 |
setuptools
|
| 28 |
-
mpmath
|
| 29 |
controlnet-aux
|
| 30 |
sentencepiece==0.2.0
|
| 31 |
optimum-quanto # has to be optimum-quanto==0.2.5 for pruna int4
|
| 32 |
-
gguf
|
| 33 |
types-Pillow
|
| 34 |
mypy
|
| 35 |
python-dotenv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use with: uv pip install --no-cache --system --index-strategy=unsafe-best-match -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
numpy
|
| 3 |
diffusers
|
| 4 |
llvmlite>=0.39.0
|
| 5 |
numba>=0.56.0
|
|
|
|
| 6 |
transformers
|
| 7 |
pydantic
|
| 8 |
huggingface-hub
|
|
|
|
| 13 |
accelerate
|
| 14 |
compel==2.0.2
|
| 15 |
controlnet-aux==0.0.9
|
| 16 |
+
peft
|
| 17 |
markdown2
|
| 18 |
safetensors
|
|
|
|
|
|
|
|
|
|
| 19 |
setuptools
|
| 20 |
+
mpmath
|
| 21 |
controlnet-aux
|
| 22 |
sentencepiece==0.2.0
|
| 23 |
optimum-quanto # has to be optimum-quanto==0.2.5 for pruna int4
|
| 24 |
+
gguf
|
| 25 |
types-Pillow
|
| 26 |
mypy
|
| 27 |
python-dotenv
|
| 28 |
+
requests>=2.31.0 # Added explicitly to resolve dependency conflict
|
| 29 |
+
|
| 30 |
+
--extra-index-url https://download.pytorch.org/whl/cu118
|
| 31 |
+
torch==2.5.1
|
| 32 |
+
torchvision
|
| 33 |
+
torchaudio
|
| 34 |
+
xformers; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 35 |
+
pruna[stable-fast] ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 36 |
+
|
| 37 |
+
# stable_fast @ https://github.com/chengzeyi/stable-fast/releases/download/nightly/stable_fast-1.0.5.dev20241127+torch230cu121-cp310-cp310-manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 38 |
+
#oneflow @ https://github.com/siliconflow/oneflow_releases/releases/download/community_cu121/oneflow-0.9.1.dev20241114%2Bcu121-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
|
| 39 |
+
#onediff @ git+https://github.com/siliconflow/onediff.git@main#egg=onediff ; sys_platform != 'darwin' or platform_machine != 'arm64'
|