digifreely commited on
Commit
b2e0eb6
Β·
verified Β·
1 Parent(s): 8af6086

Delete Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +0 -84
Dockerfile DELETED
@@ -1,84 +0,0 @@
1
- # ──────────────────────────────────────────────────────────────────────────
2
- # Dockerfile – Children's Learning Router Service
3
- # Target: Hugging Face Spaces (CPU-only, Docker SDK)
4
- # Port: 7860 (required by HF Spaces)
5
- #
6
- # Model delivery: via `preload_from_hub` in README.md
7
- # HF Spaces downloads Qwen/Qwen2.5-1.5B-Instruct before container start
8
- # and places it under /repo-cache (HF_HOME=/repo-cache).
9
- # No in-build download is needed or possible (build env has no internet).
10
- #
11
- # OOM mitigation: packages are installed in small isolated groups so pip's
12
- # dependency resolver never spikes RAM. --no-cache-dir and --no-compile
13
- # keep peak memory low throughout the build.
14
- # ──────────────────────────────────────────────────────────────────────────
15
-
16
- FROM python:3.10-slim
17
-
18
- # ── System packages ───────────────────────────────────────────────────────
19
- RUN apt-get update && apt-get install -y --no-install-recommends \
20
- build-essential \
21
- git \
22
- curl \
23
- && rm -rf /var/lib/apt/lists/*
24
-
25
- # ── Working directory ─────────────────────────────────────────────────────
26
- WORKDIR /app
27
-
28
- # ── Pip hygiene: upgrade pip/wheel first (small, fast) ───────────────────
29
- RUN pip install --no-cache-dir --no-compile --upgrade pip wheel
30
-
31
- # ── 1 of 5 Β· CPU-only PyTorch (largest wheel – install alone) ────────────
32
- RUN pip install --no-cache-dir --no-compile \
33
- torch==2.3.1 \
34
- --index-url https://download.pytorch.org/whl/cpu
35
-
36
- # ── 2 of 5 Β· HuggingFace stack (transformers pulls in tokenizers etc.) ───
37
- RUN pip install --no-cache-dir --no-compile \
38
- transformers==4.46.3 \
39
- accelerate==1.1.1
40
-
41
- # ── 3 of 5 Β· Serialisation libs ──────────────────────────────────────────
42
- RUN pip install --no-cache-dir --no-compile \
43
- sentencepiece==0.2.0 \
44
- protobuf==5.28.3
45
-
46
- # ── 4 of 5 Β· Async HTTP client ───────────────────────────────────────────
47
- RUN pip install --no-cache-dir --no-compile \
48
- httpx==0.27.2
49
-
50
- # ── 5 of 5 Β· Web framework + ASGI server ─────────────────────────────────
51
- RUN pip install --no-cache-dir --no-compile \
52
- fastapi==0.115.0 \
53
- gunicorn==22.0.0 \
54
- uvicorn[standard]==0.30.6
55
-
56
- # ── Application code ──────────────────────────────────────────────────────
57
- COPY app.py .
58
-
59
- # ── HuggingFace Spaces: run as non-root user (UID 1000) ──────────────────
60
- RUN useradd -m -u 1000 hfuser \
61
- && chown -R hfuser:hfuser /app
62
- USER hfuser
63
-
64
- # ── Runtime config ────────────────────────────────────────────────────────
65
- # HF Spaces sets HF_HOME=/repo-cache and places preload_from_hub models
66
- # there before the container starts. Pointing both vars here ensures
67
- # transformers and huggingface_hub find the pre-downloaded model weights
68
- # without any network access at runtime.
69
- ENV PYTHONUNBUFFERED=1 \
70
- PYTHONDONTWRITEBYTECODE=1 \
71
- HF_HOME=/repo-cache \
72
- TRANSFORMERS_CACHE=/repo-cache/hub
73
-
74
- EXPOSE 7860
75
-
76
- # ── Start-up command ──────────────────────────────────────────────────────
77
- # Gunicorn + uvicorn worker enables Flask async views.
78
- # --preload ensures the model is loaded ONCE before workers fork.
79
- CMD ["gunicorn", "app:app", \
80
- "--worker-class", "uvicorn.workers.UvicornWorker", \
81
- "--workers", "1", \
82
- "--bind", "0.0.0.0:7860", \
83
- "--timeout", "300", \
84
- "--preload"]