-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 987 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# syntax=docker/dockerfile:1
FROM python:3.13-slim AS builder
WORKDIR /app
# Install uv for fast package installation
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Copy project files
COPY pyproject.toml README.md ./
COPY src/ src/
# Create virtual environment and install dependencies
RUN uv venv /app/.venv && \
uv pip install --python /app/.venv/bin/python .
# Production image
FROM python:3.13-slim
WORKDIR /app
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \
NPM_MCP_TRANSPORT=http \
NPM_MCP_HOST=0.0.0.0 \
NPM_MCP_PORT=8000
# Expose port for HTTP transport
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8000/mcp', timeout=5)" || exit 1
# Run the MCP server
ENTRYPOINT ["python", "-m", "npm_mcp.main"]