Spaces:
Running
Running
FROM python:3.12 | |
# Install uv for fast Python package management | |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/ | |
# HuggingFace Spaces requires user with ID 1000 | |
RUN useradd -m -u 1000 user | |
USER user | |
# Environment setup | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH \ | |
PYTHONPATH=/home/user/app | |
WORKDIR $HOME/app | |
# Copy Python project configuration | |
COPY --chown=user pyproject.toml uv.lock* ./ | |
# Install dependencies using uv (much faster than pip) | |
RUN uv sync --frozen --no-cache | |
# Copy the entire project (respects .dockerignore) | |
COPY --chown=user . . | |
# Expose HuggingFace Spaces port | |
EXPOSE 7860 | |
# Add a verbose startup script for clearer runtime logs | |
COPY --chown=user scripts/start.sh ./start.sh | |
RUN chmod +x ./start.sh | |
# Start the MCP server via the debug-friendly script | |
CMD ["./start.sh"] |