Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +13 -6
Dockerfile
CHANGED
|
@@ -1,10 +1,17 @@
|
|
| 1 |
-
#
|
| 2 |
FROM ghcr.io/abetlen/llama-cpp-python:latest
|
| 3 |
|
| 4 |
-
#
|
| 5 |
USER root
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN pip install --no-cache-dir \
|
| 9 |
fastapi \
|
| 10 |
uvicorn \
|
|
@@ -13,15 +20,15 @@ RUN pip install --no-cache-dir \
|
|
| 13 |
pydantic \
|
| 14 |
python-telegram-bot
|
| 15 |
|
| 16 |
-
#
|
| 17 |
RUN useradd -m -u 1000 user
|
| 18 |
USER user
|
| 19 |
ENV HOME=/home/user \
|
| 20 |
PATH=/home/user/.local/bin:$PATH
|
| 21 |
WORKDIR $HOME/app
|
| 22 |
|
| 23 |
-
#
|
| 24 |
COPY --chown=user . .
|
| 25 |
|
| 26 |
-
#
|
| 27 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# 1. Use the Pre-Built Brain (Fastest)
|
| 2 |
FROM ghcr.io/abetlen/llama-cpp-python:latest
|
| 3 |
|
| 4 |
+
# 2. Switch to Root to fix the OS
|
| 5 |
USER root
|
| 6 |
|
| 7 |
+
# 🛡️ CRITICAL FIX: Install the "Internet Address Book" (DNS & Certs)
|
| 8 |
+
# This fixes the "[Errno -5]" error by teaching the server how to find websites.
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
ca-certificates \
|
| 11 |
+
openssl \
|
| 12 |
+
&& update-ca-certificates
|
| 13 |
+
|
| 14 |
+
# 3. Install Python Tools
|
| 15 |
RUN pip install --no-cache-dir \
|
| 16 |
fastapi \
|
| 17 |
uvicorn \
|
|
|
|
| 20 |
pydantic \
|
| 21 |
python-telegram-bot
|
| 22 |
|
| 23 |
+
# 4. Setup User (Required by Spaces)
|
| 24 |
RUN useradd -m -u 1000 user
|
| 25 |
USER user
|
| 26 |
ENV HOME=/home/user \
|
| 27 |
PATH=/home/user/.local/bin:$PATH
|
| 28 |
WORKDIR $HOME/app
|
| 29 |
|
| 30 |
+
# 5. Copy App
|
| 31 |
COPY --chown=user . .
|
| 32 |
|
| 33 |
+
# 6. Launch
|
| 34 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|