AIencoder commited on
Commit
4dee3a6
·
verified ·
1 Parent(s): 30dea22

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -9
Dockerfile CHANGED
@@ -4,28 +4,43 @@ FROM ghcr.io/ggml-org/llama.cpp:server AS source
4
  # Stage 2: Setup your environment using the full image
5
  FROM ghcr.io/ggml-org/llama.cpp:full
6
 
7
- # 1. FIX: Copy from /app/llama-server instead of /llama-server
8
  COPY --from=source /app/llama-server /usr/local/bin/llama-server
9
 
10
  # 2. Setup Environment
11
  WORKDIR /app
12
  ENV HF_HOME=/app/.cache
13
  ENV NUMBA_CACHE_DIR=/app/.cache
 
14
 
15
- # 3. Install Python & Fix Permissions Tools
16
  RUN apt-get update && \
17
- apt-get install -y python3 python3-pip dos2unix && \
18
- rm -rf /var/lib/apt/lists/*
 
 
 
 
 
19
 
20
  # 4. Install Python Libraries
21
- RUN pip3 install --no-cache-dir huggingface_hub
22
 
23
  # 5. Copy and Fix the Start Script
24
  COPY start.sh /app/start.sh
25
  RUN dos2unix /app/start.sh && chmod +x /app/start.sh
26
 
27
- # 6. Permissions
28
- RUN mkdir -p /app/.cache && chmod -R 777 /app
 
 
29
 
30
- # 7. Start
31
- ENTRYPOINT [ "/app/start.sh" ]
 
 
 
 
 
 
 
 
4
  # Stage 2: Setup your environment using the full image
5
  FROM ghcr.io/ggml-org/llama.cpp:full
6
 
7
+ # 1. Copy llama-server binary
8
  COPY --from=source /app/llama-server /usr/local/bin/llama-server
9
 
10
  # 2. Setup Environment
11
  WORKDIR /app
12
  ENV HF_HOME=/app/.cache
13
  ENV NUMBA_CACHE_DIR=/app/.cache
14
+ ENV LLAMA_CACHE=/app/.cache/llama.cpp
15
 
16
+ # 3. Install Python & Tools
17
  RUN apt-get update && \
18
+ apt-get install -y --no-install-recommends \
19
+ python3 \
20
+ python3-pip \
21
+ dos2unix \
22
+ curl \
23
+ && rm -rf /var/lib/apt/lists/* \
24
+ && apt-get clean
25
 
26
  # 4. Install Python Libraries
27
+ RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub
28
 
29
  # 5. Copy and Fix the Start Script
30
  COPY start.sh /app/start.sh
31
  RUN dos2unix /app/start.sh && chmod +x /app/start.sh
32
 
33
+ # 6. Create directories and set permissions
34
+ RUN mkdir -p /app/.cache/llama.cpp \
35
+ && mkdir -p /app/models \
36
+ && chmod -R 777 /app
37
 
38
+ # 7. Expose port
39
+ EXPOSE 7860
40
+
41
+ # 8. Health check
42
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
43
+ CMD curl -f http://localhost:7860/health || exit 1
44
+
45
+ # 9. Start
46
+ ENTRYPOINT ["/app/start.sh"]