Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -18
Dockerfile
CHANGED
|
@@ -1,21 +1,17 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
RUN pip install --no-cache-dir --upgrade pip
|
| 9 |
-
|
| 10 |
-
# 2. Install generic dependencies
|
| 11 |
-
RUN pip install --no-cache-dir -r /code/requirements.txt
|
| 12 |
-
|
| 13 |
-
# 3. THE FIX: Pin to version 0.2.90
|
| 14 |
-
# We specify "==0.2.90" to force it to use the existing pre-built wheel.
|
| 15 |
-
# This avoids the "Building wheel..." step that causes the Timeout.
|
| 16 |
-
RUN pip install --no-cache-dir llama-cpp-python==0.2.90 \
|
| 17 |
-
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 18 |
-
|
| 19 |
-
COPY . .
|
| 20 |
-
|
| 21 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use the official image. The engine is already installed here.
|
| 2 |
+
FROM ghcr.io/abetlen/llama-cpp-python:latest
|
| 3 |
|
| 4 |
+
# Switch to root to install Gradio
|
| 5 |
+
USER root
|
| 6 |
+
RUN python3 -m pip install --upgrade pip
|
| 7 |
+
RUN python3 -m pip install gradio huggingface_hub
|
| 8 |
|
| 9 |
+
# Setup User (Required by Hugging Face Spaces security)
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
USER user
|
| 12 |
+
ENV HOME=/home/user \
|
| 13 |
+
PATH=/home/user/.local/bin:$PATH
|
| 14 |
+
WORKDIR $HOME/app
|
| 15 |
+
COPY --chown=user . $HOME/app
|
| 16 |
|
| 17 |
+
CMD ["python3", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|