From 2cb4a3adec8adcaa4c067febb71bb0dc5afbbfe8 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 30 Dec 2025 19:47:54 +0000 Subject: [PATCH] Fix build: use setuptools and uv, multi-stage Dockerfile --- Dockerfile | 39 +++++++++++++++++++++++++++------------ pyproject.toml | 9 ++++++--- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5e68e6..997612b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,35 @@ -FROM python:3.11-slim +# Stage 1: Builder for dependencies +FROM python:3.11-slim-bullseye AS builder WORKDIR /app -# Install dependencies -COPY pyproject.toml . -RUN pip install --no-cache-dir . +# Install uv +RUN pip install uv -# Copy application -COPY server.py . +# Copy only dependency files first to leverage Docker cache +COPY pyproject.toml ./ -# Expose port +# Install dependencies with uv +RUN uv pip install --system . + +# Stage 2: Final image +FROM python:3.11-slim-bullseye + +# Install curl for health checks +RUN apt-get update && apt-get install -y --no-install-recommends curl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy installed dependencies from builder +COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/ +COPY --from=builder /usr/local/bin/ /usr/local/bin/ + +# Copy application code +COPY server.py ./ + +# Expose the port Uvicorn will listen on EXPOSE 8000 -# Health check -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD python -c "import httpx; httpx.get('http://localhost:8000/health').raise_for_status()" - -# Run server +# Run the server CMD ["python", "server.py"] diff --git a/pyproject.toml b/pyproject.toml index 6173787..c302e6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "outline-mcp-custom" +name = "outline-mcp" version = "0.1.0" description = "MCP server for Outline knowledge base" requires-python = ">=3.11" @@ -18,5 +18,8 @@ dev = [ ] [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.uv] +python-version = "3.11"