Spaces:
gijl
/
Sleeping

gijl commited on
Commit
c0455fe
ยท
verified ยท
1 Parent(s): 0e2e0ab

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +54 -0
  2. start.sh +20 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
2
+ # Stage 1: ุชุญู…ูŠู„ ุงู„ู†ู…ูˆุฐุฌ
3
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
4
+ FROM ghcr.io/ggml-org/llama.cpp:full AS model-downloader
5
+
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ python3 python3-pip python3-venv \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ RUN python3 -m venv /opt/venv
11
+ ENV PATH="/opt/venv/bin:$PATH"
12
+ RUN pip install -U --no-cache-dir pip huggingface_hub
13
+
14
+ RUN python3 -c '\
15
+ from huggingface_hub import hf_hub_download; \
16
+ repo="gijl/gemma-4-E2B-it-GGUF"; \
17
+ hf_hub_download(repo_id=repo, filename="gemma-4-E2B-it-BF16.gguf", local_dir="/app"); \
18
+ hf_hub_download(repo_id=repo, filename="mmproj-BF16.gguf", local_dir="/app")'
19
+
20
+
21
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
22
+ # Stage 2: ุงู„ุตูˆุฑุฉ ุงู„ู†ู‡ุงุฆูŠุฉ
23
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
24
+ FROM ghcr.io/ggml-org/llama.cpp:full
25
+
26
+ WORKDIR /app
27
+
28
+ # Node.js 20 LTS
29
+ RUN apt-get update && apt-get install -y --no-install-recommends \
30
+ curl ca-certificates \
31
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
32
+ && apt-get install -y --no-install-recommends nodejs \
33
+ && npm install -g npm@latest \
34
+ && rm -rf /var/lib/apt/lists/*
35
+
36
+ # ู†ุณุฎ ุงู„ู†ู…ุงุฐุฌ ู…ู† ุงู„ู…ุฑุญู„ุฉ ุงู„ุฃูˆู„ู‰
37
+ COPY --from=model-downloader /app/*.gguf /app/
38
+
39
+ # ูˆุงุฌู‡ุฉ ุงู„ุฏุฑุฏุดุฉ + ุงู„ุณูŠุฑูุฑ
40
+ COPY chat.html /app/chat.html
41
+ COPY server.js /app/server.js
42
+ COPY start.sh /app/start.sh
43
+ RUN chmod +x /app/start.sh
44
+
45
+ # ุงู„ุชุฎุฒูŠู† ุงู„ุฏุงุฆู…
46
+ RUN mkdir -p /data/projects /data/logs /data/exports
47
+ VOLUME ["/data"]
48
+
49
+ # ุงู„ุจูˆุฑุชุงุช:
50
+ # 7860 = llama.cpp API
51
+ # 3000 = ูˆุงุฌู‡ุฉ ุงู„ุฏุฑุฏุดุฉ
52
+ EXPOSE 7860 3000
53
+
54
+ ENTRYPOINT ["/app/start.sh"]
start.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "๐Ÿš€ Starting llama.cpp server on port 7860..."
5
+ /app/llama-server \
6
+ -m /app/gemma-4-E2B-it-BF16.gguf \
7
+ --mmproj /app/mmproj-BF16.gguf \
8
+ --host 0.0.0.0 \
9
+ --port 7860 \
10
+ -t 2 \
11
+ --cache-type-k q8_0 \
12
+ --cache-type-v iq4_nl \
13
+ -c 12800 \
14
+ -n 38912 &
15
+
16
+ echo "๐ŸŒ Starting Chat UI on port 3000..."
17
+ node /app/server.js &
18
+
19
+ # Wait for both
20
+ wait