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

Fix(docker): start of the model when building the Docker image

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -4
Dockerfile CHANGED
@@ -5,12 +5,13 @@ RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
- # Install system dependencies needed for many ML/AI packages
9
  USER root
10
  RUN apt-get update && apt-get install -y \
11
  build-essential \
12
  gcc \
13
  g++ \
 
14
  libffi-dev \
15
  libsm6 \
16
  libxext6 \
@@ -31,11 +32,20 @@ WORKDIR /app
31
  # Copy and install dependencies
32
  COPY --chown=user ./requirements.txt requirements.txt
33
  RUN pip install --upgrade pip \
 
34
  && pip install --no-cache-dir -r requirements.txt
35
 
 
 
 
 
 
 
 
 
 
36
  # Copy the rest of the project
37
  COPY --chown=user . /app
38
 
39
- # Default command to run the app
40
- # Notice we point to "app.main:app" because main.py is inside the "app" folder
41
- CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
 
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 \
 
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
42
+ USER user
43
+
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"]