CrazyMonkey0 commited on
Commit
23187e2
·
1 Parent(s): 101988f

chore(docker): reintroduce llama-cpp-python pre-built wheel for faster build

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -7
Dockerfile CHANGED
@@ -1,15 +1,23 @@
1
- # Use official Python 3.12 image
2
- FROM python:3.12
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Upgrade pip
8
- RUN pip install --upgrade pip
 
 
 
 
 
9
 
10
- # Copy requirements and install dependencies
11
  COPY ./requirements.txt /app/requirements.txt
12
- RUN pip install --no-cache-dir --force-reinstall -r requirements.txt
 
 
 
13
 
14
  # Copy application code
15
  COPY . /app
@@ -17,5 +25,5 @@ COPY . /app
17
  # Expose FastAPI port
18
  EXPOSE 7860
19
 
20
- # Use Gunicorn with Uvicorn workers
21
  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 for smaller size
2
+ FROM python:3.12-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install minimal system dependencies for llama-cpp-python
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
+ RUN pip install --upgrade pip && \
18
+ pip install --no-cache-dir --force-reinstall \
19
+ -r requirements.txt \
20
+ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
21
 
22
  # Copy application code
23
  COPY . /app
 
25
  # Expose FastAPI port
26
  EXPOSE 7860
27
 
28
+ # Start FastAPI with Gunicorn + Uvicorn
29
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]