CrazyMonkey0 commited on
Commit
f45e402
·
1 Parent(s): 89865a6

feat(python): Change Python version to 3.11-bullseye for llama-cpp-python prebuilt wheel

Browse files
Files changed (2) hide show
  1. Dockerfile +16 -18
  2. models.sh +0 -9
Dockerfile CHANGED
@@ -1,36 +1,34 @@
1
- FROM python:3.12-slim
 
2
 
3
- # Create non-root user
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
- # Install system dependencies
9
- USER root
10
  RUN apt-get update && apt-get install -y \
11
- build-essential \
12
- cmake \
13
  wget \
14
  curl \
15
  git \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # Back to non-root
19
- USER user
20
- WORKDIR /app
21
-
22
  # Upgrade pip
23
  RUN pip install --upgrade pip
24
 
25
- # Install llama-cpp prebuilt wheel (FAST, no compiling)
26
  RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
27
 
28
- # Install project requirements
29
- COPY --chown=user ./requirements.txt requirements.txt
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
  # Copy application code
33
- COPY --chown=user . /app
 
 
 
 
 
 
34
 
35
- # Start app
36
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
 
1
+ # Use full Python image for compatibility with prebuilt wheels
2
+ FROM python:3.11-bullseye
3
 
4
+ # Set workdir
5
+ WORKDIR /app
 
 
6
 
7
+ # Install basic system dependencies
 
8
  RUN apt-get update && apt-get install -y \
 
 
9
  wget \
10
  curl \
11
  git \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
 
14
  # Upgrade pip
15
  RUN pip install --upgrade pip
16
 
17
+ # Install llama-cpp-python prebuilt wheel (CPU)
18
  RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
19
 
20
+ # Copy project requirements and install
21
+ COPY ./requirements.txt /app/requirements.txt
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
  # Copy application code
25
+ COPY . /app
26
+
27
+ # Ensure models folder exists (optional)
28
+ RUN mkdir -p /app/models
29
+
30
+ # Expose port (change if needed)
31
+ EXPOSE 7860
32
 
33
+ # Start FastAPI app with Uvicorn workers
34
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
models.sh DELETED
@@ -1,9 +0,0 @@
1
- #!/bin/bash
2
- echo "Creating models directory..."
3
- mkdir -p /app/models/
4
-
5
- echo "Downloading Qwen3-8B-GGUF model..."
6
- wget -c https://huggingface.co/Qwen/Qwen3-8B-GGUF/resolve/main/Qwen3-8B-Q5_K_M.gguf?download=true \
7
- -O /app/models/Qwen3-8B-Q5_K_M.gguf
8
-
9
- echo "All models downloaded!"