Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +22 -10
Dockerfile
CHANGED
|
@@ -1,23 +1,35 @@
|
|
| 1 |
FROM python:3.11
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
cmake \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
python3-dev \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
# Copy
|
| 13 |
-
COPY requirements.txt .
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
RUN pip install llama-cpp-python
|
| 18 |
|
| 19 |
-
# Copy
|
| 20 |
-
COPY app.py .
|
| 21 |
|
| 22 |
EXPOSE 7860 7861
|
| 23 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.11
|
| 2 |
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
+
FORCE_CMAKE=1 \
|
| 5 |
+
PYTHONUNBUFFERED=1
|
| 6 |
+
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# Install build tools and libs needed by llama-cpp-python
|
| 10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
build-essential \
|
| 12 |
cmake \
|
| 13 |
+
git \
|
| 14 |
+
pkg-config \
|
| 15 |
+
libopenblas-dev \
|
| 16 |
+
libomp-dev \
|
| 17 |
+
libgomp1 \
|
| 18 |
python3-dev \
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
+
# Copy only the requirements first so this layer can be cached when app sources change
|
| 22 |
+
COPY requirements.txt /app/requirements.txt
|
| 23 |
+
|
| 24 |
+
# Upgrade pip tooling and install requirements
|
| 25 |
+
RUN pip install --upgrade pip setuptools wheel && \
|
| 26 |
+
pip install --no-cache-dir -r /app/requirements.txt
|
| 27 |
|
| 28 |
+
# Install llama-cpp-python (build from source if wheel not available)
|
| 29 |
+
RUN pip install --no-cache-dir llama-cpp-python
|
| 30 |
|
| 31 |
+
# Copy app sources
|
| 32 |
+
COPY app.py /app/app.py
|
| 33 |
|
| 34 |
EXPOSE 7860 7861
|
| 35 |
+
CMD ["python", "app.py"]
|