Tim Luka Horstmann
commited on
Commit
·
47d79de
1
Parent(s):
f62dc45
remove manual llama build
Browse files- Dockerfile +13 -27
- requirements.txt +15 -4
Dockerfile
CHANGED
|
@@ -1,42 +1,28 @@
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
-
FROM python:3.10
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
ENV
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
PATH=/root/.cargo/bin:$PATH \
|
| 9 |
-
TRANSFORMERS_CACHE=/app/cache \
|
| 10 |
-
HF_HOME=/app/cache
|
| 11 |
|
| 12 |
# Set working directory
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
# Install system dependencies
|
| 16 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
&& rm -rf /var/lib/apt/lists/* \
|
| 20 |
-
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
|
| 21 |
-
&& rustup default stable
|
| 22 |
|
| 23 |
# Prepare cache directory
|
| 24 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 25 |
|
| 26 |
-
# Copy and install Python
|
| 27 |
COPY requirements.txt .
|
| 28 |
-
RUN sed -i '/llama-cpp-python/d' requirements.txt \
|
| 29 |
-
&& pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
&& cd /tmp/llama-cpp-python \
|
| 35 |
-
# ensure we have all submodules
|
| 36 |
-
&& git submodule update --init --recursive \
|
| 37 |
-
# install from source
|
| 38 |
-
&& python -m pip install --no-cache-dir . \
|
| 39 |
-
&& rm -rf /tmp/llama-cpp-python
|
| 40 |
|
| 41 |
# Copy application code and data
|
| 42 |
COPY app.py cv_embeddings.json cv_text.txt ./
|
|
@@ -45,4 +31,4 @@ COPY app.py cv_embeddings.json cv_text.txt ./
|
|
| 45 |
EXPOSE 7860
|
| 46 |
|
| 47 |
# Launch
|
| 48 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV TRANSFORMERS_CACHE=/app/cache \
|
| 6 |
+
HF_HOME=/app/cache \
|
| 7 |
+
DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Install minimal system dependencies for running the app
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
libgomp1 \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Prepare cache directory
|
| 18 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 19 |
|
| 20 |
+
# Copy requirements and install Python packages
|
| 21 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# Install most packages from requirements.txt, then llama-cpp-python with binary-only
|
| 24 |
+
RUN grep -v "llama-cpp-python" requirements.txt | pip install --no-cache-dir -r /dev/stdin \
|
| 25 |
+
&& pip install --no-cache-dir --only-binary=all llama-cpp-python==0.3.14
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Copy application code and data
|
| 28 |
COPY app.py cv_embeddings.json cv_text.txt ./
|
|
|
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
# Launch
|
| 34 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
|
@@ -3,11 +3,22 @@ uvicorn==0.31.0
|
|
| 3 |
sentence-transformers==3.1.1
|
| 4 |
torch==2.4.1
|
| 5 |
numpy==1.26.4
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
asyncio
|
| 10 |
psutil
|
| 11 |
google-genai
|
| 12 |
elevenlabs
|
| 13 |
-
httpx
|
|
|
|
| 3 |
sentence-transformers==3.1.1
|
| 4 |
torch==2.4.1
|
| 5 |
numpy==1.26.4
|
| 6 |
+
huggingface_hub==0.30.1
|
| 7 |
+
faiss-cpu==1.8.0
|
| 8 |
+
psutil
|
| 9 |
+
google-genai
|
| 10 |
+
elevenlabs==1.1.3
|
| 11 |
+
httpx==0.25.0
|
| 12 |
+
llama-cpp-python==0.3.25.0
|
| 13 |
+
uvicorn==0.31.0
|
| 14 |
+
sentence-transformers==3.1.1
|
| 15 |
+
torch==2.4.1
|
| 16 |
+
numpy==1.26.4
|
| 17 |
+
llama-cpp-python=0.3.14
|
| 18 |
+
huggingface_hub==0.30.1
|
| 19 |
+
faiss-cpu==1.8.0
|
| 20 |
asyncio
|
| 21 |
psutil
|
| 22 |
google-genai
|
| 23 |
elevenlabs
|
| 24 |
+
httpx==0.25.0
|