Spaces:
Build error
Build error
| # Base image | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV HOME=/app | |
| ENV STREAMLIT_HOME=/app/.streamlit | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| software-properties-common \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy app files | |
| COPY requirements.txt . | |
| COPY app.py . | |
| # Install Python dependencies | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| # Create a writable .streamlit directory | |
| RUN mkdir -p $STREAMLIT_HOME | |
| # Optional: basic Streamlit config to avoid warnings | |
| RUN echo "\ | |
| [server]\n\ | |
| headless = true\n\ | |
| enableCORS = false\n\ | |
| port = 8501\n\ | |
| " > $STREAMLIT_HOME/config.toml | |
| # Expose Streamlit port | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Start the Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |