Spaces:
Sleeping
Sleeping
| # Use Python 3.9 slim image | |
| FROM python:3.9-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set HOME so Streamlit doesn't try to write to / | |
| ENV HOME=/app | |
| # Create .streamlit directory so Streamlit can store config | |
| RUN mkdir -p /app/.streamlit | |
| # Configure Streamlit (disable CORS, telemetry, etc.) | |
| RUN echo "\ | |
| [general]\n\ | |
| email = \"\"\n\ | |
| \n\ | |
| [server]\n\ | |
| headless = true\n\ | |
| enableCORS = false\n\ | |
| \n\ | |
| [browser]\n\ | |
| gatherUsageStats = false\n\ | |
| " > /app/.streamlit/config.toml | |
| # Copy requirements | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY src/ ./src/ | |
| # Expose default Streamlit port | |
| EXPOSE 8501 | |
| # Healthcheck for Hugging Face Spaces | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Run Streamlit, using PORT from environment if provided, else default to 8501 | |
| CMD ["sh", "-c", "streamlit run src/streamlit_app.py --server.port=${PORT:-8501} --server.address=0.0.0.0"] | |
| # ################################################################################################## | |
| # FROM python:3.9-slim | |
| # WORKDIR /app | |
| # # Install required packages | |
| # RUN apt-get update && apt-get install -y \ | |
| # build-essential \ | |
| # curl \ | |
| # git \ | |
| # && rm -rf /var/lib/apt/lists/* | |
| # # Set HOME so Streamlit doesn't try to write to / | |
| # ENV HOME=/app | |
| # # Create .streamlit directory so Streamlit can store config | |
| # RUN mkdir -p /app/.streamlit | |
| # # Optional: Disable telemetry collection if desired | |
| # RUN echo "\ | |
| # [general]\n\ | |
| # email = \"\"\n\ | |
| # \n\ | |
| # [server]\n\ | |
| # headless = true\n\ | |
| # enableCORS = false\n\ | |
| # \n\ | |
| # [browser]\n\ | |
| # gatherUsageStats = false\n\ | |
| # " > /app/.streamlit/config.toml | |
| # # Copy files | |
| # COPY requirements.txt ./ | |
| # COPY src/ ./src/ | |
| # # Install Python dependencies | |
| # RUN pip3 install --no-cache-dir -r requirements.txt | |
| # EXPOSE 8501 | |
| # HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |