-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (37 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
47 lines (37 loc) · 1.44 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
# Dockerfile
#
# Multi-stage build for polybridge-mcp.
#
# Stage 1 (builder) : installs all dependencies and compiles TypeScript.
# Stage 2 (runtime) : copies only the compiled output and production deps.
#
# This two-stage approach keeps the final image small by excluding the
# TypeScript compiler, dev tools, and source files from the runtime image.
# ---------------------------------------------------------------------------
# Stage 1 : builder
# ---------------------------------------------------------------------------
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files first. Docker caches this layer separately from source
# code, so `npm install` only re-runs when package.json changes.
COPY package*.json ./
RUN npm ci
# Copy source code and compile.
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
# ---------------------------------------------------------------------------
# Stage 2 : runtime
# ---------------------------------------------------------------------------
FROM node:20-alpine AS runtime
WORKDIR /app
# Only install production dependencies in the final image.
COPY package*.json ./
RUN npm ci --omit=dev
# Copy the compiled JavaScript from the builder stage.
COPY --from=builder /app/dist ./dist
# Create the default workspace directory.
RUN mkdir -p /app/workspace
# The server runs on stdio — no port to expose.
# Claude Desktop spawns this container as a child process.
CMD ["node", "dist/server/index.js"]