| # Use a Python base image, preferably a slim version for smaller image size | |
| FROM python:3.10-slim-buster | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file and install Python dependencies | |
| # Using --no-cache-dir for smaller image size during pip install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy your MCP server script into the container | |
| COPY app.py . | |
| # Expose the port your application will listen on. | |
| # Hugging Face Spaces typically routes traffic to port 7860. | |
| EXPOSE 7860 | |
| # Command to run your MCP server when the container starts | |
| # The `python -u` flag ensures unbuffered stdout, which is good for real-time logging in containers. | |
| CMD ["python", "-u", "app.py"] |