Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +10 -13
Dockerfile
CHANGED
|
@@ -8,22 +8,19 @@ ENV HOME=/home/user \
|
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
-
# 2. Install
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
-
USER user
|
| 19 |
|
| 20 |
-
# 3. Install
|
| 21 |
COPY --chown=user requirements.txt requirements.txt
|
| 22 |
-
|
|
|
|
| 23 |
pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
-
# 4. Copy
|
| 26 |
COPY --chown=user . .
|
| 27 |
-
|
| 28 |
-
# 5. Launch the Librarian
|
| 29 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
+
# 2. BYPASS BUILD: Install the Pre-Compiled Engine
|
| 12 |
+
# We use a specific URL to get the "CPU Wheel" (Binary) directly.
|
| 13 |
+
# This takes 30 seconds instead of 30 minutes.
|
| 14 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 15 |
+
pip install llama-cpp-python \
|
| 16 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# 3. Install the Rest
|
| 19 |
COPY --chown=user requirements.txt requirements.txt
|
| 20 |
+
# We remove llama-cpp-python from requirements so it doesn't try to rebuild it
|
| 21 |
+
RUN sed -i '/llama-cpp-python/d' requirements.txt && \
|
| 22 |
pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
+
# 4. Copy Code & Launch
|
| 25 |
COPY --chown=user . .
|
|
|
|
|
|
|
| 26 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|