Update Dockerfile
Browse files- Dockerfile +8 -10
Dockerfile
CHANGED
|
@@ -1,15 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
RUN
|
| 5 |
-
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
-
|
| 7 |
-
# Python deps
|
| 8 |
-
RUN pip install --no-cache-dir fastapi "uvicorn[standard]" llama-cpp-python requests
|
| 9 |
|
| 10 |
-
#
|
|
|
|
| 11 |
WORKDIR /app
|
|
|
|
|
|
|
| 12 |
COPY . /app
|
| 13 |
-
|
| 14 |
EXPOSE 8000
|
| 15 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
|
|
|
| 1 |
+
# Stage 1: Build llama-cpp-python
|
| 2 |
+
FROM python:3.11-slim as builder
|
| 3 |
+
RUN apt-get update && apt-get install -y git build-essential cmake wget
|
| 4 |
+
RUN pip wheel --no-cache-dir llama-cpp-python==0.1.79 -w /wheels
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
# Stage 2: Final image
|
| 7 |
+
FROM python:3.11-slim
|
| 8 |
WORKDIR /app
|
| 9 |
+
COPY --from=builder /wheels /wheels
|
| 10 |
+
RUN pip install --no-cache-dir /wheels/* fastapi "uvicorn[standard]" requests
|
| 11 |
COPY . /app
|
|
|
|
| 12 |
EXPOSE 8000
|
| 13 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|