DGXAI/driftcall
0
1# syntax=docker/dockerfile:1.62# Unified DriftCall Space — same base + deps as env Space, plus the3# pre-built frontend dist/ mounted at root.4 5FROM python:3.11-slim AS builder6ENV PIP_NO_CACHE_DIR=1 \7 PIP_DISABLE_PIP_VERSION_CHECK=1 \8 PYTHONDONTWRITEBYTECODE=19WORKDIR /build10RUN apt-get update && apt-get install -y --no-install-recommends \11 build-essential git libsndfile1 ffmpeg \12 && rm -rf /var/lib/apt/lists/*13 14COPY requirements.txt ./15RUN pip install --prefix=/install -r requirements.txt16 17# Pre-pull TTS / ASR weights so the runtime container can run offline.18RUN pip install --prefix=/install huggingface_hub19RUN PYTHONPATH=/install/lib/python3.11/site-packages \20 python -c "from huggingface_hub import snapshot_download; \21 snapshot_download('hexgrad/Kokoro-82M', cache_dir='/weights'); \22 snapshot_download('Systran/faster-whisper-small', cache_dir='/weights')"23 24# -------- runtime --------25FROM python:3.11-slim26ENV PYTHONUNBUFFERED=1 \27 PYTHONDONTWRITEBYTECODE=1 \28 HF_HOME=/root/.cache/huggingface \29 TRANSFORMERS_OFFLINE=1 \30 HF_HUB_OFFLINE=1 \31 WANDB_PROJECT=driftcall \32 WANDB_MODE=disabled33 34RUN apt-get update && apt-get install -y --no-install-recommends \35 libsndfile1 ffmpeg ca-certificates \36 && rm -rf /var/lib/apt/lists/*37 38COPY --from=builder /install /usr/local39COPY --from=builder /weights /root/.cache/huggingface40 41WORKDIR /app42 43# Application code (cells/ + app.py + openenv.yaml + data/) and the44# pre-built frontend dist/ (mounted at / by unified_app.py).45COPY cells/ ./cells/46COPY data/ ./data/47COPY app.py openenv.yaml unified_app.py ./48COPY site/ ./site/49 50EXPOSE 786051 52HEALTHCHECK --interval=30s --timeout=5s --start-period=45s \53 CMD python -c "import urllib.request; \54 urllib.request.urlopen('http://127.0.0.1:7860/healthz', timeout=4).read()" \55 || exit 156 57# unified_app:app exposes both the OpenEnv routes (at root) and the58# static frontend (mounted at /).59CMD ["uvicorn", "unified_app:app", \60 "--host", "0.0.0.0", \61 "--port", "7860", \62 "--workers", "2", \63 "--timeout-keep-alive", "30", \64 "--log-level", "info"]65 