Spaces:
Paused
Paused
| # Use Ubuntu-based Python image for better Linux compatibility | |
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| curl \ | |
| wget \ | |
| build-essential \ | |
| sqlite3 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user for security | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set working directory | |
| WORKDIR $HOME/app | |
| # Copy requirements and install dependencies | |
| COPY --chown=user 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"] | |