PolyHedra / Dockerfile
yf176
fix: copy README.md before pip install in Dockerfile
1de344a
Raw History Blame Contribute Delete
1.07 kB
# Polyhedra — Hugging Face Spaces deployment
# HF Spaces requires the app to listen on port 7860.
FROM python:3.12-slim
# Non-root user required by HF Spaces
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*
# Install deps first for layer caching
COPY --chown=user:user pyproject.toml README.md ./
RUN mkdir -p src/polyhedra && touch src/polyhedra/__init__.py \
&& pip install --no-cache-dir -e . 2>/dev/null; true
# Copy real source and reinstall (no-deps — deps already cached above)
COPY --chown=user:user src/ ./src/
RUN pip install --no-cache-dir --no-deps -e .
# Session storage (ephemeral)
RUN mkdir -p /home/user/.polyhedra/sessions && chown -R user:user /home/user/.polyhedra
USER user
# Secrets are injected as env vars from HF Space settings
# Required: GEMINI_API_KEY, SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET
ENV REDIS_URL=""
EXPOSE 7860
CMD ["uvicorn", "polyhedra.app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]