Spaces:
Paused
Paused
| FROM python:3.9 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| ENV PATH="/root/.cargo/bin:${PATH}" | |
| # Install uv for faster package management | |
| RUN pip install --no-cache-dir uv | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies with Rust support | |
| RUN . $HOME/.cargo/env && uv pip install --system -r requirements.txt | |
| # Copy application code | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| COPY --chown=user . /app | |
| # HuggingFace environment variables | |
| ENV HF_TOKEN="" | |
| ENV HF_API_BASE="https://api-inference.huggingface.co" | |
| # Application configuration | |
| ENV OPENAI_API_KEY="" | |
| ENV ANTHROPIC_API_KEY="" | |
| ENV LOG_LEVEL="INFO" | |
| # Expose ports | |
| EXPOSE 7860 8000 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| # Gradio apps run on port 7860 by default | |
| CMD ["python", "app.py"] | |