Spaces:
Sleeping
Sleeping
Gokul commited on
Commit ·
e715e8f
1
Parent(s): ca51a6c
Force binary install to fix hang
Browse files- Dockerfile +10 -14
Dockerfile
CHANGED
|
@@ -9,32 +9,28 @@ RUN useradd -m -u 1000 user
|
|
| 9 |
USER user
|
| 10 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
|
| 12 |
-
# 4. Install system
|
| 13 |
-
# ⚡ FIX: We add 'build-essential' and 'cmake' so it can compile the AI engine
|
| 14 |
USER root
|
| 15 |
-
RUN apt-get update && apt-get install -y
|
| 16 |
-
build-essential \
|
| 17 |
-
cmake \
|
| 18 |
-
curl \
|
| 19 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
USER user
|
| 21 |
|
| 22 |
# 5. Copy requirements
|
| 23 |
COPY --chown=user requirements.txt .
|
| 24 |
|
| 25 |
-
# 6.
|
| 26 |
RUN pip install --no-cache-dir --upgrade pip
|
| 27 |
-
# We install torch first
|
| 28 |
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
# Install the rest
|
| 34 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 35 |
|
| 36 |
-
#
|
| 37 |
COPY --chown=user . .
|
| 38 |
|
| 39 |
-
#
|
| 40 |
CMD ["uvicorn", "api.index:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 9 |
USER user
|
| 10 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
|
| 12 |
+
# 4. Install system basics
|
|
|
|
| 13 |
USER root
|
| 14 |
+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
USER user
|
| 16 |
|
| 17 |
# 5. Copy requirements
|
| 18 |
COPY --chown=user requirements.txt .
|
| 19 |
|
| 20 |
+
# 6. ⚡ SPEED FIX: Force Binary Installation
|
| 21 |
RUN pip install --no-cache-dir --upgrade pip
|
|
|
|
| 22 |
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
|
| 23 |
|
| 24 |
+
# 👇 THIS IS THE KEY CHANGE:
|
| 25 |
+
# We force it to use a pre-built wheel. If this fails, it fails instantly (no 30 min wait).
|
| 26 |
+
RUN pip install --no-cache-dir llama-cpp-python \
|
| 27 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 28 |
|
| 29 |
+
# 7. Install the rest
|
| 30 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
|
| 32 |
+
# 8. Copy App Code
|
| 33 |
COPY --chown=user . .
|
| 34 |
|
| 35 |
+
# 9. Start Server
|
| 36 |
CMD ["uvicorn", "api.index:app", "--host", "0.0.0.0", "--port", "7860"]
|