http-mcp / Dockerfile
abdurrahman
Refactor Dockerfile to streamline dependency installation process
be0f4a3
raw
history blame contribute delete
848 Bytes
# Dockerfile for HTTP MCP Server (FastMCP)
# Optimized for HuggingFace Spaces (runs as non-root user, port 7860)
FROM python:3.12-slim
# Install dependencies as root into system Python
RUN pip install --no-cache-dir uv
COPY requirements.txt .
RUN UV_LINK_MODE=copy uv pip install --system --no-cache -r requirements.txt
# HuggingFace Spaces runs containers as a non-root user (UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR $HOME/app
# Copy application
COPY --chown=user http_mcp_server.py .
# HuggingFace Spaces expects port 7860
EXPOSE 7860
# Environment variables (set these as HF Space Secrets):
# GOOGLE_CLIENT_ID
# GOOGLE_CLIENT_SECRET
# ALLOWED_EMAILS (comma-separated)
CMD ["python", "http_mcp_server.py"]