qwen_2.5_model / Dockerfile
MuhammadNoman7600's picture
Create Dockerfile
2d3dc96 verified
# ============================================================
# Dockerfile β€” Qwen3.5-0.8B CPU-Only API for HF Spaces
# No GPU required. Port 7860.
# ============================================================
FROM python:3.11-slim
# ── System deps ──
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
# ── Python deps (CPU-only torch β€” no CUDA bloat) ──
RUN pip install --no-cache-dir \
torch --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir \
transformers \
accelerate \
fastapi \
uvicorn \
pydantic \
huggingface_hub
# ── Pre-download model at build time (~1.8 GB baked into image) ──
ENV HF_HOME=/tmp/hf_cache
RUN python3 -c "\
from huggingface_hub import snapshot_download; \
snapshot_download('Qwen/Qwen2.5-0.5B-Instruct', cache_dir='/tmp/hf_cache')"
# ── Copy app ──
WORKDIR /app
COPY app.py .
EXPOSE 7860
CMD ["python3", "app.py"]