Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +24 -20
Dockerfile
CHANGED
|
@@ -1,33 +1,37 @@
|
|
| 1 |
-
# 1. Use
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
# 2.
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
RUN apt-get update && apt-get install -y \
|
|
|
|
| 10 |
ca-certificates \
|
| 11 |
-
|
| 12 |
-
&&
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
fastapi \
|
| 17 |
uvicorn \
|
| 18 |
huggingface_hub \
|
| 19 |
python-dotenv \
|
| 20 |
pydantic \
|
| 21 |
-
python-telegram-bot
|
| 22 |
-
|
| 23 |
-
|
| 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
|
| 31 |
COPY --chown=user . .
|
| 32 |
|
| 33 |
# 6. Launch
|
|
|
|
| 1 |
+
# 1. Use Python 3.10 (The Golden Standard - Stable & Compatible)
|
| 2 |
+
FROM python:3.10-slim-bullseye
|
| 3 |
|
| 4 |
+
# 2. Setup User (Hugging Face Requirement)
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV HOME=/home/user \
|
| 8 |
+
PATH=/home/user/.local/bin:$PATH
|
| 9 |
+
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
+
# 3. Install Basic Tools (As Root)
|
| 12 |
+
USER root
|
| 13 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
curl \
|
| 15 |
ca-certificates \
|
| 16 |
+
build-essential \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
USER user
|
| 19 |
|
| 20 |
+
# 4. INSTALL AXIOM ENGINE (Binary Mode)
|
| 21 |
+
# Critical: We point to the "whl/cpu" URL to download the pre-built engine.
|
| 22 |
+
# This avoids the "Build Error" and installs in seconds.
|
| 23 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 24 |
+
pip install --no-cache-dir \
|
| 25 |
fastapi \
|
| 26 |
uvicorn \
|
| 27 |
huggingface_hub \
|
| 28 |
python-dotenv \
|
| 29 |
pydantic \
|
| 30 |
+
python-telegram-bot \
|
| 31 |
+
llama-cpp-python \
|
| 32 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
# 5. Copy the Brain Script
|
| 35 |
COPY --chown=user . .
|
| 36 |
|
| 37 |
# 6. Launch
|