# Use official Python base image FROM python:3.10-slim # App metadata for Hugging Face Spaces Docker SDK LABEL title="MCP Research" LABEL emoji="🚀" LABEL colorFrom="red" LABEL colorTo="red" LABEL sdk="docker" LABEL app_port="8501" LABEL tags="streamlit" LABEL pinned="false" LABEL short_description="Streamlit template space" # Set environment variables for Streamlit config and permissions ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV HOME=/app ENV STREAMLIT_CONFIG_DIR=/app/.streamlit # Set working directory WORKDIR /app # System dependencies (edit as needed) RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy all app source COPY . . # Create .streamlit directory and set permissions RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit # Add a default Streamlit config.toml (overwrite with your own if needed) RUN echo "\ [server]\n\ headless = true\n\ port = 8501\n\ address = \"0.0.0.0\"\n\ enableCORS = false\n\ enableXsrfProtection = false\n\ \n\ [theme]\n\ primaryColor = \"#e63946\"\n\ backgroundColor = \"#0E1117\"\n\ secondaryBackgroundColor = \"#1a1a2e\"\n\ textColor = \"#FAFAFA\"\n\ font = \"sans serif\"\n\ " > /app/.streamlit/config.toml # Expose the Streamlit port EXPOSE 8501 # Use shell-form CMD for Hugging Face Spaces compatibility CMD streamlit run app.py --server.port=8501 --server.address=0.0.0.0