File size: 1,071 Bytes
891fe52
 
 
 
 
 
 
 
 
 
 
 
 
1de344a
891fe52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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"]