File size: 1,111 Bytes
b32b87d dd4200b b32b87d | 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 34 35 36 | FROM python:3.10-slim
# System deps for Pillow (libjpeg, zlib) + curl for healthcheck.
RUN apt-get update && apt-get install -y --no-install-recommends \
libjpeg-dev \
zlib1g-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces require a non-root user with $HOME=/home/user.
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Install Python deps first so they cache across code changes.
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the rest of the app.
COPY --chown=user . .
# HF Spaces routes external traffic to port 7860 inside the container.
EXPOSE 7860
# Bind to 0.0.0.0 so HF's proxy can reach us. Disable Gradio's analytics
# (it tries to phone home and slows boot). ORACLES_FORCE_MOCK is left
# unset so the app uses the real Modal LLM when the secrets are present.
ENV GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SERVER_PORT=7860 \
GRADIO_ANALYTICS_ENABLED=False \
PYTHONUNBUFFERED=1 \
ORACLES_VISUAL_MODE=lean
CMD ["python", "app.py"]
|