Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -20
Dockerfile
CHANGED
|
@@ -1,29 +1,22 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
#
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
-
|
| 11 |
-
PATH=/home/user/.local/bin:$PATH
|
| 12 |
-
WORKDIR $HOME/app
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
RUN
|
| 16 |
-
USER user
|
| 17 |
-
|
| 18 |
-
# 4. Install Gradio first to establish the web server
|
| 19 |
-
RUN pip install --no-cache-dir gradio huggingface-hub hf-transfer numpy
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 25 |
|
| 26 |
COPY --chown=user . .
|
| 27 |
|
| 28 |
-
# Use
|
| 29 |
CMD ["python", "-u", "app.py"]
|
|
|
|
| 1 |
+
# This image comes with llama-cpp-python PRE-INSTALLED and optimized
|
| 2 |
+
FROM ghcr.io/abetlen/llama-cpp-python:latest
|
| 3 |
|
| 4 |
+
# Switch to root to set up the HF user
|
| 5 |
+
USER root
|
| 6 |
+
RUN apt-get update && apt-get install -y curl git procps && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 7 |
|
| 8 |
+
# Setup HF compatible user
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
+
WORKDIR /home/user/app
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# Install the few extra things we need
|
| 13 |
+
RUN pip install --no-cache-dir gradio huggingface-hub hf-transfer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Give permissions to the user
|
| 16 |
+
RUN chown -R user:user /home/user/app
|
| 17 |
+
USER user
|
|
|
|
| 18 |
|
| 19 |
COPY --chown=user . .
|
| 20 |
|
| 21 |
+
# Use the same app.py logic
|
| 22 |
CMD ["python", "-u", "app.py"]
|