Spaces:
Sleeping
Sleeping
CrazyMonkey0
commited on
Commit
·
fd4e818
1
Parent(s):
6151d5f
fix(docker): resolve llama-cpp-python module import error
Browse files- Dockerfile +12 -13
Dockerfile
CHANGED
|
@@ -1,29 +1,28 @@
|
|
| 1 |
-
# Use official Python 3.12 slim image
|
| 2 |
FROM python:3.12-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install minimal
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
-
build-essential \
|
| 10 |
wget \
|
| 11 |
curl \
|
| 12 |
-
git \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Upgrade pip and install llama-cpp-python pre-built wheel + other dependencies
|
| 16 |
COPY ./requirements.txt /app/requirements.txt
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 21 |
|
| 22 |
-
#
|
|
|
|
|
|
|
| 23 |
COPY . /app
|
| 24 |
|
| 25 |
-
# Expose FastAPI port
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
|
| 29 |
-
CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]
|
|
|
|
| 1 |
+
# Use official Python 3.12 slim image
|
| 2 |
FROM python:3.12-slim
|
| 3 |
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install minimal runtime dependencies
|
| 7 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 8 |
wget \
|
| 9 |
curl \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
COPY ./requirements.txt /app/requirements.txt
|
| 13 |
+
|
| 14 |
+
# Upgrade pip
|
| 15 |
+
RUN pip install --upgrade pip
|
| 16 |
+
|
| 17 |
+
# Install llama-cpp-python from pre-built wheel
|
| 18 |
+
RUN pip install llama-cpp-python \
|
| 19 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 20 |
|
| 21 |
+
# Install other requirements
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
+
|
| 24 |
COPY . /app
|
| 25 |
|
|
|
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]
|
|
|