eumora-api / Dockerfile
VivDubs's picture
fix: move Dockerfile back to root for HF Spaces compatibility
a52832b
Raw
History Blame Contribute Delete
1.03 kB
# ---- base ----
FROM python:3.11-slim AS base
WORKDIR /app
# System deps for torch/transformers (no CUDA needed for CPU inference)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# ---- deps ----
FROM base AS deps
COPY backend/requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# ---- app ----
FROM deps AS app
# Copy source — paths relative to repo root (HF Spaces build context)
COPY backend/src/ ./src/
COPY backend/api.py .
# HuggingFace cache lives in a writable dir
ENV HF_HOME=/app/.cache/huggingface
RUN mkdir -p /app/.cache/huggingface
# HF Spaces runs containers as a non-root user (uid 1000)
RUN useradd -m -u 1000 appuser && chown -R appuser /app
USER appuser
# Port the API listens on
EXPOSE 8000
# Start uvicorn with 1 worker (DeBERTa is memory-heavy; scale horizontally)
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]