CrazyMonkey0 commited on
Commit
74de35c
·
1 Parent(s): 9c29a0e

Fix(docker): repair building llama.cpp

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -20
Dockerfile CHANGED
@@ -1,41 +1,32 @@
1
  FROM python:3.12-slim
2
 
3
- # Create a 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
- gcc \
13
- g++ \
14
  cmake \
15
- libffi-dev \
16
- libsm6 \
17
- libxext6 \
18
- libxrender-dev \
19
- ffmpeg \
20
- libsndfile1 \
21
  wget \
22
  curl \
23
  git \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
- # Switch back to non-root user
27
  USER user
28
-
29
- # Set working directory
30
  WORKDIR /app
31
 
32
- # Copy and install dependencies
 
 
 
 
 
 
33
  COPY --chown=user ./requirements.txt requirements.txt
34
- RUN pip install --upgrade pip \
35
- && CMAKE_ARGS="-DLLAMA_CUBLAS=off" pip install llama-cpp-python \
36
- && pip install --no-cache-dir -r requirements.txt
37
 
38
- # Copy models download script
39
  COPY --chown=user ./models.sh models.sh
40
  USER root
41
  RUN chmod +x /app/models.sh
@@ -44,8 +35,7 @@ USER user
44
  # Download models
45
  RUN ./models.sh
46
 
47
- # Copy the rest of the project
48
  COPY --chown=user . /app
49
 
50
- # Default command
51
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
 
1
  FROM python:3.12-slim
2
 
 
3
  RUN useradd -m -u 1000 user
4
  USER user
5
  ENV PATH="/home/user/.local/bin:$PATH"
6
 
 
7
  USER root
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
 
 
10
  cmake \
 
 
 
 
 
 
11
  wget \
12
  curl \
13
  git \
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
16
  USER user
 
 
17
  WORKDIR /app
18
 
19
+ # Upgrade pip
20
+ RUN pip install --upgrade pip
21
+
22
+ # Zainstaluj llama-cpp z pre-built wheel (SZYBKIE!)
23
+ RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
24
+
25
+ # Requirements
26
  COPY --chown=user ./requirements.txt requirements.txt
27
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
28
 
29
+ # Models script
30
  COPY --chown=user ./models.sh models.sh
31
  USER root
32
  RUN chmod +x /app/models.sh
 
35
  # Download models
36
  RUN ./models.sh
37
 
38
+ # Copy app
39
  COPY --chown=user . /app
40
 
 
41
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]