Spaces:
Sleeping
Sleeping
| # GNoME Materials Discovery MCP Service | |
| # Dockerfile for HuggingFace Spaces Deployment | |
| # Use Python 3.11 slim image | |
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONIOENCODING=utf-8 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| GNOME_DATA_DIR=/app/gnome_data \ | |
| GNOME_MODEL_DIR=/app/models \ | |
| HF_HOME=/app/huggingface | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| wget \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create app directory | |
| WORKDIR /app | |
| # Create data directories first | |
| RUN mkdir -p /app/gnome_data /app/models | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Download core dataset during Docker build | |
| # This ensures data is available immediately when Space starts | |
| RUN echo "Downloading GNoME core dataset..." && \ | |
| python download_data.py && \ | |
| echo "Dataset download complete!" | |
| # Expose port for SSE | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Run the MCP server | |
| CMD ["python", "entrypoint.py"] | |