cb-demo / Dockerfile
DimmingLight's picture
Upload Dockerfile with huggingface_hub
d60479d verified
Raw History Blame Contribute Delete
1.16 kB
# Streamlit demo image — CPU-only, slim deps (app.py), always-on cloud backup.
#
# Build: docker build -t cb-demo .
# Run: docker run -p 8501:8501 cb-demo
#
# Checkpoints (~1.75GB under models/) are gitignored and NOT baked in: the app
# pulls them at boot from a HF model repo via HF_CHECKPOINTS_REPO + HF_TOKEN
# (see app._ensure_checkpoints). DEMO_AUTOWARM=1 pre-loads all 4 models at boot
# so the first request is instant.
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
TRANSFORMERS_VERBOSITY=error \
DEMO_AUTOWARM=1
WORKDIR /app
# CPU-only torch first (avoids the ~2GB CUDA wheel), then the slim demo deps.
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
COPY requirements-demo.txt .
RUN pip install --no-cache-dir -r requirements-demo.txt
# App code + committed demo artifacts (results/demo/*.json power Tab 1).
COPY . .
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
CMD ["streamlit", "run", "app.py", \
"--server.port=8501", "--server.address=0.0.0.0", \
"--server.headless=true", "--browser.gatherUsageStats=false"]