Spaces:
Sleeping
Sleeping
| FROM python:3.13.5-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt ./ | |
| RUN pip3 install -r requirements.txt | |
| # Copy all project files | |
| COPY . ./ | |
| # Create writable .streamlit folder with proper permissions | |
| RUN mkdir -p /app/.streamlit && chmod 755 /app/.streamlit | |
| # Add Streamlit config to disable usage stats collection | |
| RUN echo "[browser]\ngatherUsageStats = false\n[server]\nheadless = true\nport = 8501\nenableCORS = false\nenableXsrfProtection = false\n" > /app/.streamlit/config.toml | |
| # Set proper permissions for the config file | |
| RUN chmod 644 /app/.streamlit/config.toml | |
| # Create a non-root user for better security | |
| RUN useradd -m -u 1000 streamlit && chown -R streamlit:streamlit /app | |
| # Switch to non-root user | |
| USER streamlit | |
| # Set environment variables | |
| ENV STREAMLIT_CONFIG_DIR=/app/.streamlit | |
| ENV HOME=/app | |
| ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| 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"] |