PaperMate / Dockerfile
Phuc-HugigFace's picture
chore(deploy): add Hugging Face Docker Space config
276a51e
Raw
History Blame
1 kB
# PaperMate β€” Hugging Face Docker Space
# FastAPI app that also serves the static frontend at /app.
FROM python:3.11-slim
# Build deps some PDF / native wheels need.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces run the container as uid 1000 β€” create a matching user.
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR $HOME/app
# Install Python deps first for better layer caching.
COPY --chown=user backend/requirements.txt ./backend/requirements.txt
RUN pip install --no-cache-dir -r backend/requirements.txt
# App code.
COPY --chown=user . .
# Writable data dirs (ephemeral on HF free tier β€” artifacts live in Supabase).
RUN mkdir -p data/jobs data/logs
# HF Docker Spaces expose port 7860.
EXPOSE 7860
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]