Spaces:
Runtime error
Runtime error
first commit
Browse files- Dockerfile +55 -0
Dockerfile
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM docker.io/library/python:3.10@sha256:76f22e4ce53774c1f5eb0ba145edb57b908e7aa329fee75eca69b511c1d0cd8a
|
2 |
+
|
3 |
+
WORKDIR /home/user/app
|
4 |
+
|
5 |
+
# Install uv and create virtual environment
|
6 |
+
RUN python -m pip install uv && \
|
7 |
+
uv venv --python=3.12 .venv && \
|
8 |
+
. .venv/bin/activate
|
9 |
+
|
10 |
+
# Base pip updates and initial packages
|
11 |
+
RUN pip install --no-cache-dir pip -U && \
|
12 |
+
pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
|
13 |
+
|
14 |
+
# System packages installation
|
15 |
+
RUN --mount=target=/tmp/packages.txt,source=packages.txt \
|
16 |
+
apt-get update && \
|
17 |
+
xargs -r -a /tmp/packages.txt apt-get install -y && \
|
18 |
+
apt-get install -y curl && \
|
19 |
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
20 |
+
apt-get install -y nodejs && \
|
21 |
+
rm -rf /var/lib/apt/lists/* && \
|
22 |
+
apt-get clean
|
23 |
+
|
24 |
+
# Fakeroot setup
|
25 |
+
RUN apt-get update && \
|
26 |
+
apt-get install -y fakeroot && \
|
27 |
+
mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
28 |
+
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
|
29 |
+
chmod +x /usr/bin/apt-get && \
|
30 |
+
rm -rf /var/lib/apt/lists/* && \
|
31 |
+
useradd -m -u 1000 user
|
32 |
+
|
33 |
+
# Copy files and install requirements
|
34 |
+
COPY --chown=1000:1000 --from=root / /
|
35 |
+
|
36 |
+
# Install requirements in specific order
|
37 |
+
RUN . .venv/bin/activate && \
|
38 |
+
pip install -r .venv/requirements-cpu.txt && \
|
39 |
+
pip install -e .venv/. && \
|
40 |
+
pip install -e .
|
41 |
+
|
42 |
+
RUN pip freeze > /tmp/freeze.txt
|
43 |
+
|
44 |
+
# Additional system packages
|
45 |
+
RUN apt-get update && \
|
46 |
+
apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx && \
|
47 |
+
rm -rf /var/lib/apt/lists/* && \
|
48 |
+
git lfs install
|
49 |
+
|
50 |
+
# Install Gradio and related packages
|
51 |
+
RUN . .venv/bin/activate && \
|
52 |
+
pip install --no-cache-dir gradio[oauth]==5.8.0 "uvicorn>=0.14.0" spaces
|
53 |
+
|
54 |
+
COPY --link --chown=1000 ./ /home/user/app
|
55 |
+
COPY --from=pipfreeze --link --chown=1000 /tmp/freeze.txt /tmp/freeze.txt
|