Fix build: use setuptools and uv, multi-stage Dockerfile
All checks were successful
Build and Push Outline MCP Docker Image / build (push) Successful in 15s
All checks were successful
Build and Push Outline MCP Docker Image / build (push) Successful in 15s
This commit is contained in:
39
Dockerfile
39
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
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies
|
# Install uv
|
||||||
COPY pyproject.toml .
|
RUN pip install uv
|
||||||
RUN pip install --no-cache-dir .
|
|
||||||
|
|
||||||
# Copy application
|
# Copy only dependency files first to leverage Docker cache
|
||||||
COPY server.py .
|
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
|
EXPOSE 8000
|
||||||
|
|
||||||
# Health check
|
# Run the server
|
||||||
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
|
|
||||||
CMD ["python", "server.py"]
|
CMD ["python", "server.py"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "outline-mcp-custom"
|
name = "outline-mcp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "MCP server for Outline knowledge base"
|
description = "MCP server for Outline knowledge base"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
@@ -18,5 +18,8 @@ dev = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["setuptools>=61.0"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
python-version = "3.11"
|
||||||
|
|||||||
Reference in New Issue
Block a user