Dnfs commited on
Commit
e4c3b29
·
verified ·
1 Parent(s): 067ca1c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -9
Dockerfile CHANGED
@@ -2,8 +2,6 @@
2
  FROM python:3.10-slim
3
 
4
  # 2. Install system dependencies REQUIRED FOR COMPILING llama-cpp-python
5
- # This is the key fix for the build error.
6
- # We run this as root before switching to the non-root user.
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  cmake \
@@ -21,24 +19,27 @@ WORKDIR $HOME/app
21
  # 5. Copy requirements first for better Docker layer caching
22
  COPY --chown=user requirements.txt .
23
 
24
- # 6. Install Python dependencies for the non-root user
25
- # This will now succeed because the build tools are available.
 
 
 
26
  RUN pip install --no-cache-dir --user -r requirements.txt
27
 
28
- # 7. Download the model during the build process
29
  RUN huggingface-cli download Dnfs/gema-4b-indra10k-model1-Q4_K_M-GGUF \
30
  --local-dir ./model \
31
  --local-dir-use-symlinks False
32
 
33
- # 8. Copy the rest of the application code
34
  COPY --chown=user app.py .
35
 
36
- # 9. Expose the port the app runs on
37
  EXPOSE 8000
38
 
39
- # 10. Health check to ensure the app is running
40
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
41
  CMD curl -f http://localhost:8000/health || exit 1
42
 
43
- # 11. Command to run the application
44
  CMD ["python", "app.py"]
 
2
  FROM python:3.10-slim
3
 
4
  # 2. Install system dependencies REQUIRED FOR COMPILING llama-cpp-python
 
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  cmake \
 
19
  # 5. Copy requirements first for better Docker layer caching
20
  COPY --chown=user requirements.txt .
21
 
22
+ # 6. Set build arguments to speed up llama-cpp-python installation
23
+ # This is the key fix for the timeout error. It disables GPU support checks.
24
+ ENV CMAKE_ARGS="-DLLAMA_CUBLAS=OFF -DLLAMA_METAL=OFF"
25
+
26
+ # 7. Install Python dependencies for the non-root user
27
  RUN pip install --no-cache-dir --user -r requirements.txt
28
 
29
+ # 8. Download the model during the build process
30
  RUN huggingface-cli download Dnfs/gema-4b-indra10k-model1-Q4_K_M-GGUF \
31
  --local-dir ./model \
32
  --local-dir-use-symlinks False
33
 
34
+ # 9. Copy the rest of the application code
35
  COPY --chown=user app.py .
36
 
37
+ # 10. Expose the port the app runs on
38
  EXPOSE 8000
39
 
40
+ # 11. Health check to ensure the app is running
41
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
42
  CMD curl -f http://localhost:8000/health || exit 1
43
 
44
+ # 12. Command to run the application
45
  CMD ["python", "app.py"]