suppa09 commited on
Commit
177f47d
·
verified ·
1 Parent(s): 6f5e9c3

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -39
Dockerfile CHANGED
@@ -1,54 +1,22 @@
1
- # PolyBloom ML Ensemble Service v15.0 — Dockerfile
2
- # Fixes vs original:
3
- # - python -c inline scripts rewritten as single lines (no shell \ continuation)
4
- # - MOIRAI download made optional (uni2ts removed from requirements)
5
- # - MOMENT download made optional (momentfm removed from requirements)
6
- # - Only Chronos is a hard real-ML model; LightGBM bootstraps at runtime
7
-
8
  FROM python:3.11-slim
9
 
10
- # ── Environment ────────────────────────────────────────────────────────────────
11
  ENV PYTHONUNBUFFERED=1 \
12
  PIP_NO_CACHE_DIR=1 \
13
  HF_HOME=/tmp/hf \
14
  TRANSFORMERS_CACHE=/tmp/hf \
15
  PORT=7860
16
 
17
- # ── System deps ────────────────────────────────────────────────────────────────
18
- RUN apt-get update && apt-get install -y --no-install-recommends \
19
- build-essential git curl && \
20
- rm -rf /var/lib/apt/lists/*
21
-
22
  WORKDIR /app
23
 
24
- # ── Python deps ────────────────────────────────────────────────────────────────
 
 
25
  COPY requirements.txt .
26
- RUN pip install --upgrade pip && \
27
- pip install torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu && \
28
- pip install -r requirements.txt
29
 
30
- # ── App code ───────────────────────────────────────────────────────────────────
31
  COPY app.py .
32
 
33
- # ── Pre-download ML model weights at BUILD TIME ────────────────────────────────
34
- # Each command is a single line to avoid shell/Python indentation conflicts.
35
-
36
- # 1. Chronos (Amazon T5-small ~300 MB) — primary real ML model
37
- RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('amazon/chronos-t5-small', cache_dir='/tmp/hf')" || echo "WARNING: Chronos download failed — will fall back to Holt-Winters at runtime"
38
-
39
- # 2. MOIRAI small (~500 MB) — optional, uni2ts not installed so will be skipped by app.py
40
- RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('Salesforce/moirai-1.1-R-small', cache_dir='/tmp/hf')" || echo "WARNING: MOIRAI download failed — bootstrap fallback will be used"
41
-
42
- # 3. MOMENT-1-large (~1.4 GB) — optional, momentfm not installed so will be skipped by app.py
43
- RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('AutonLab/MOMENT-1-large', cache_dir='/tmp/hf')" || echo "WARNING: MOMENT download failed — PatchTST-formula fallback will be used"
44
-
45
- # ── Optional: LightGBM production model ───────────────────────────────────────
46
- # COPY lgbm_model.pkl /app/lgbm_model.pkl
47
-
48
- # ── Expose + start ─────────────────────────────────────────────────────────────
49
  EXPOSE 7860
50
-
51
- HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
52
- CMD curl -f http://localhost:7860/ || exit 1
53
-
54
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # HuggingFace Spaces Docker SDK — runs on port 7860
2
+ # v16 — adds XGBoost + CatBoost + LightGBM. libgomp1 is required by all three.
 
 
 
 
 
3
  FROM python:3.11-slim
4
 
 
5
  ENV PYTHONUNBUFFERED=1 \
6
  PIP_NO_CACHE_DIR=1 \
7
  HF_HOME=/tmp/hf \
8
  TRANSFORMERS_CACHE=/tmp/hf \
9
  PORT=7860
10
 
 
 
 
 
 
11
  WORKDIR /app
12
 
13
+ RUN apt-get update && apt-get install -y --no-install-recommends \
14
+ build-essential git curl libgomp1 && rm -rf /var/lib/apt/lists/*
15
+
16
  COPY requirements.txt .
17
+ RUN pip install --upgrade pip && pip install -r requirements.txt
 
 
18
 
 
19
  COPY app.py .
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  EXPOSE 7860
22
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]