fugthchat commited on
Commit
19623b8
·
1 Parent(s): a0fddee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -15
Dockerfile CHANGED
@@ -1,29 +1,26 @@
1
- # Use a lightweight Python base to save download time
2
  FROM python:3.9-slim
3
 
4
- # Install system compilers (needed for fast AI math)
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- cmake \
8
- && rm -rf /var/lib/apt/lists/*
9
-
10
  # Set working directory
11
  WORKDIR /code
12
 
13
- # --- SMART CACHING LAYER ---
14
- # We copy ONLY requirements first.
15
- # Docker will cache this step. If you change app.py later,
16
- # it will SKIP installing these again!
17
  COPY ./requirements.txt /code/requirements.txt
 
 
18
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
19
 
20
- # --- CODE LAYER ---
21
- # Now copy the rest of the code
 
 
 
 
22
  COPY . .
23
 
24
- # Create cache directory for Hugging Face permissions
25
  RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
26
  ENV TRANSFORMERS_CACHE=/code/.cache
27
 
28
- # Start the app
29
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use lightweight Python
2
  FROM python:3.9-slim
3
 
 
 
 
 
 
 
4
  # Set working directory
5
  WORKDIR /code
6
 
7
+ # Copy requirements
 
 
 
8
  COPY ./requirements.txt /code/requirements.txt
9
+
10
+ # 1. Install the easy packages first
11
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
+ # 2. THE FAST FIX: Install Pre-Compiled AI Engine
14
+ # This downloads the binary instead of compiling it (Saves 20 mins)
15
+ RUN pip install llama-cpp-python \
16
+ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
17
+
18
+ # Copy the rest of the app
19
  COPY . .
20
 
21
+ # Permissions for Hugging Face
22
  RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
23
  ENV TRANSFORMERS_CACHE=/code/.cache
24
 
25
+ # Start App
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]