Skip to content

Commit a69b8cb

Browse files
committed
Add Dockerfile for MCP registry support
This Dockerfile enables the chrome-devtools-mcp server to be used with Docker-based MCP registries. It: - Uses Node.js 22 LTS with Chrome dependencies - Installs Chrome Stable for Puppeteer - Builds the TypeScript project - Runs as non-root user for security - Exposes the MCP server via stdio
1 parent c3784d1 commit a69b8cb

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

Dockerfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Build stage
2+
FROM node:22-bookworm-slim AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy all source files
7+
COPY . .
8+
9+
# Install all dependencies (including dev dependencies for building)
10+
RUN npm ci
11+
12+
# Build the TypeScript project
13+
RUN npm run build
14+
15+
# Runtime stage
16+
FROM node:22-bookworm-slim
17+
18+
# Install Chromium and dependencies
19+
RUN apt-get update && apt-get install -y \
20+
chromium \
21+
fonts-liberation \
22+
libasound2 \
23+
libatk-bridge2.0-0 \
24+
libatk1.0-0 \
25+
libatspi2.0-0 \
26+
libcups2 \
27+
libdbus-1-3 \
28+
libdrm2 \
29+
libgbm1 \
30+
libgtk-3-0 \
31+
libnspr4 \
32+
libnss3 \
33+
libwayland-client0 \
34+
libxcomposite1 \
35+
libxdamage1 \
36+
libxfixes3 \
37+
libxkbcommon0 \
38+
libxrandr2 \
39+
xdg-utils \
40+
&& rm -rf /var/lib/apt/lists/*
41+
42+
WORKDIR /app
43+
44+
# Copy package files
45+
COPY package*.json ./
46+
47+
# Install only production dependencies, skip prepare script
48+
RUN npm ci --omit=dev --ignore-scripts
49+
50+
# Copy built files from builder stage
51+
COPY --from=builder /app/build ./build
52+
53+
# Set environment to tell Puppeteer where Chromium is installed
54+
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
55+
56+
# Run as non-root user for security
57+
RUN groupadd -r mcpuser && useradd -r -g mcpuser -G audio,video mcpuser \
58+
&& mkdir -p /home/mcpuser/Downloads \
59+
&& chown -R mcpuser:mcpuser /home/mcpuser \
60+
&& chown -R mcpuser:mcpuser /app
61+
62+
USER mcpuser
63+
64+
# Expose MCP server via stdio
65+
ENTRYPOINT ["node", "build/src/index.js"]

0 commit comments

Comments
 (0)