samiulttr commited on
Commit
af381bb
·
verified ·
1 Parent(s): 6ae8bf5

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -18
Dockerfile CHANGED
@@ -1,30 +1,30 @@
1
  # ============================================================
2
- # HFS_1 v4 — Gemma 4 12B LLM API Server
3
  #
4
  # সমস্যার ইতিহাস:
5
- # v1: llama.cpp source build → OOMKilled (16GB RAM শেষ)
6
- # v2: llama-cpp-python==0.3.9, extra-index-url → wheel নেই → source build → gcc নেই → fail
7
- # v3: gcc install + llama-cpp-python==0.3.27 build → OOMKilled (16GB RAM শেষ)
 
8
  #
9
- # v4 চূড়ান্ত সমাধান:
10
- # Direct pre-built wheel URL দি়ে install → ZERO compilation
11
- # Source: sergey21000/llama-cpp-python-wheels (GitHub)
12
- # Wheel: llama_cpp_python-0.3.15-cp311-cp311-linux_x86_64.whl
13
- # Size: ~4MB, install time: <10 seconds
14
  # ============================================================
15
 
16
  FROM python:3.10-slim
17
 
18
  ARG DEBIAN_FRONTEND=noninteractive
19
 
20
- # ── Minimal runtime libs only (gcc/cmake নেই!) ───────────────
21
- # libopenblas0: CPU matrix acceleration (runtime)
22
- # libgomp1: OpenMP threading (runtime)
23
- # curl: health check
24
  RUN apt-get update && apt-get install -y --no-install-recommends \
25
  libopenblas0 \
26
  libgomp1 \
27
  curl \
 
28
  && apt-get clean \
29
  && rm -rf /var/lib/apt/lists/*
30
 
@@ -34,11 +34,30 @@ RUN pip install --no-cache-dir \
34
  "hf-transfer==0.1.8" \
35
  "requests==2.32.3"
36
 
37
- # ── llama-cpp-python: PRE-BUILT WHEEL (zero compilation!) ─────
38
- # sergey21000/llama-cpp-python-wheels থেকে direct download
39
- # Python 3.11 / Linux x86_64 / CPU-only / v0.3.15
40
- # v0.3.15 এ Gemma 3/4 chat format সাপোর্ট আছ
41
  RUN pip install --no-cache-dir \
42
  "https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.22-cp310-cp310-linux_x86_64.whl"
43
 
44
- # ── FastAPI server ──────────────────────────────────────
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # ============================================================
2
+ # HFS_1 v5 — Gemma 4 12B LLM API Server
3
  #
4
  # সমস্যার ইতিহাস:
5
+ # v1: llama.cpp source build → OOMKilled
6
+ # v2: wheel নেই → source build → gcc নেই → fail
7
+ # v3: gcc install + build → OOMKilled
8
+ # v4: python:3.10 + Luigi wheel → app startup হয় না (permission)
9
  #
10
+ # v5 সমাধান:
11
+ # - python:3.10-slim (Luigi wheel এর জন্)
12
+ # - Luigi/llama-cpp-python wheel (Gemma 4 সাপোর্ট, Jan 2026)
13
+ # - USER root এ চালানো (HFS free tier এ permission সমস্যা এড়াতে)
 
14
  # ============================================================
15
 
16
  FROM python:3.10-slim
17
 
18
  ARG DEBIAN_FRONTEND=noninteractive
19
 
20
+ WORKDIR /app
21
+
22
+ # ── System libs ───────────────────────────────────────────────
 
23
  RUN apt-get update && apt-get install -y --no-install-recommends \
24
  libopenblas0 \
25
  libgomp1 \
26
  curl \
27
+ bash \
28
  && apt-get clean \
29
  && rm -rf /var/lib/apt/lists/*
30
 
 
34
  "hf-transfer==0.1.8" \
35
  "requests==2.32.3"
36
 
37
+ # ── llama-cpp-python: PRE-BUILT WHEEL ─────────────────────────
38
+ # Luigi fork HFS free CPU এর জন্য তৈরি
39
+ # Python 3.10 / Linux x86_64 / CPU+OpenBLAS / Jan 2026 build
40
+ # Gemma 4 সহ সব আধুনিক architecture সাপোর্ট কর
41
  RUN pip install --no-cache-dir \
42
  "https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.22-cp310-cp310-linux_x86_64.whl"
43
 
44
+ # ── FastAPI server ─────────────────────────────────────────────
45
+ RUN pip install --no-cache-dir \
46
+ "fastapi==0.115.5" \
47
+ "uvicorn[standard]==0.32.1" \
48
+ "pydantic==2.10.3"
49
+
50
+ # ── App files ─────────────────────────────────────────────────
51
+ COPY download_model.py .
52
+ COPY start.sh .
53
+ COPY api_server.py .
54
+
55
+ RUN chmod +x /app/start.sh
56
+ RUN mkdir -p /app/models
57
+
58
+ # NOTE: root হিসেবে চালানো হচ্ছে (HFS free tier)
59
+ # useradd বাদ দেওয়া হয়েছে — permission সমস্যা এড়াতে
60
+
61
+ EXPOSE 7860
62
+
63
+ CMD ["/bin/bash", "/app/start.sh"]