MuhammadNoman7600 commited on
Commit
39d2798
Β·
verified Β·
1 Parent(s): 898bb4e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -4
Dockerfile CHANGED
@@ -1,16 +1,34 @@
 
 
 
 
 
1
  FROM python:3.11-slim
2
 
3
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
 
 
 
4
 
5
- # CPU-only torch
6
- RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
 
7
 
8
  RUN pip install --no-cache-dir \
9
  transformers \
 
10
  fastapi \
11
  uvicorn \
12
- pydantic
 
 
 
 
 
 
 
13
 
 
14
  WORKDIR /app
15
  COPY app.py .
16
 
 
1
+ # ============================================================
2
+ # Dockerfile β€” Qwen3.5-0.8B CPU-Only API for HF Spaces
3
+ # No GPU required. Port 7860.
4
+ # ============================================================
5
+
6
  FROM python:3.11-slim
7
 
8
+ # ── System deps ──
9
+ RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends git && \
11
+ rm -rf /var/lib/apt/lists/*
12
 
13
+ # ── Python deps (CPU-only torch β€” no CUDA bloat) ──
14
+ RUN pip install --no-cache-dir \
15
+ torch --index-url https://download.pytorch.org/whl/cpu
16
 
17
  RUN pip install --no-cache-dir \
18
  transformers \
19
+ accelerate \
20
  fastapi \
21
  uvicorn \
22
+ pydantic \
23
+ huggingface_hub
24
+
25
+ # ── Pre-download model at build time (~1.8 GB baked into image) ──
26
+ ENV HF_HOME=/tmp/hf_cache
27
+ RUN python3 -c "\
28
+ from huggingface_hub import snapshot_download; \
29
+ snapshot_download('Qwen/Qwen3.5-0.8B', cache_dir='/tmp/hf_cache')"
30
 
31
+ # ── Copy app ──
32
  WORKDIR /app
33
  COPY app.py .
34