# Dockerfile for Hugging Face Spaces - Streamlit App FROM python:3.10-slim # Install system dependencies (including git and wget for HF Spaces) RUN apt-get update && apt-get install -y \ build-essential \ curl \ wget \ git \ && rm -rf /var/lib/apt/lists/* # Create user with UID 1000 (required by HF Spaces) RUN useradd -m -u 1000 user # Set home directory and working directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements file and change ownership COPY --chown=user:user requirements.txt . # Switch to user before installing dependencies USER user # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files with proper ownership COPY --chown=user:user app.py . COPY --chown=user:user log_parser.py . # Copy Streamlit configuration for HF Spaces COPY --chown=user:user .streamlit .streamlit # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Set environment variables for Streamlit ENV STREAMLIT_SERVER_PORT=7860 \ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ STREAMLIT_SERVER_HEADLESS=true \ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false # Run the application CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]