-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (67 loc) · 2.66 KB
/
Dockerfile
File metadata and controls
87 lines (67 loc) · 2.66 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# syntax=docker/dockerfile:1
# =============================================================================
# Builder Stage: Install dependencies and build the package
# =============================================================================
FROM python:3.11-slim AS builder
# Set environment variables for Python
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
# Copy only dependency files first for better layer caching
COPY pyproject.toml ./
COPY README.md ./
# Copy source code
COPY src/ ./src/
# Install the package with MCP extras
RUN pip install --no-cache-dir ".[mcp]"
# =============================================================================
# Runtime Stage: Slim production image
# =============================================================================
FROM python:3.11-slim AS runtime
# Metadata labels
LABEL maintainer="Matthew G. Monteleone <matthewm@augmentcode.com>" \
description="DevRev MCP Server - A Model Context Protocol server for the DevRev platform" \
version="2.6.0" \
org.opencontainers.image.source="https://github.com/mgmonteleone/py-dev-rev" \
org.opencontainers.image.title="DevRev MCP Server" \
org.opencontainers.image.description="Production-ready MCP server for DevRev API integration" \
org.opencontainers.image.version="2.6.0" \
org.opencontainers.image.licenses="MIT"
# Set environment variables for Python
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/home/mcp/.local/bin:$PATH"
# Install runtime dependencies (curl for healthcheck)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 -s /bin/bash mcp && \
mkdir -p /app && \
chown -R mcp:mcp /app
# Set working directory
WORKDIR /app
# Copy Python packages 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/devrev-mcp-server /usr/local/bin/devrev-mcp-server
# Switch to non-root user
USER mcp
# Expose the HTTP port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Set the entry point
ENTRYPOINT ["devrev-mcp-server"]
# Default command arguments
CMD ["--transport", "streamable-http", "--host", "0.0.0.0", "--port", "8080"]