Spaces:
Running
Running
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install git for pip install from GitHub | |
| RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create startup script that installs timebench at runtime (when secrets are available) | |
| RUN echo '#!/bin/bash\n\ | |
| if [ -n "$GITHUB_TOKEN" ]; then\n\ | |
| echo "Installing timebench from private GitHub repo..."\n\ | |
| pip install --no-cache-dir git+https://oauth2:${GITHUB_TOKEN}@github.com/zqiao11/TIME.git\n\ | |
| else\n\ | |
| echo "Installing timebench from public GitHub repo..."\n\ | |
| pip install --no-cache-dir git+https://github.com/zqiao11/TIME.git\n\ | |
| fi\n\ | |
| exec python app.py\n' > /app/start.sh && chmod +x /app/start.sh | |
| # Expose Gradio default port | |
| EXPOSE 7860 | |
| # Set environment variables | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| ENV GRADIO_SERVER_PORT="7860" | |
| # Run the startup script | |
| CMD ["/app/start.sh"] | |