11# syntax=docker/dockerfile:1.23.0
22
3-
43# FROM oven/bun:1.3.2-alpine AS builder
54# Use node because of bun issue blocking at `Creating an optimized production build ...`
65# https://github.com/oven-sh/bun/issues/17136
@@ -9,13 +8,8 @@ FROM node:22-alpine AS builder
98
109RUN npm install -g bun@1.3.12
1110
12- # Create app directory
1311WORKDIR /workspace
1412
15- # RUN apk add --no-cache wget
16-
17- # Copy the rest of the source code
18- # Remove directories to keep the image slim
1913COPY \
2014 --exclude=packages/@intlayer/vue-compiler \
2115 --exclude=packages/@intlayer/svelte-compiler \
5347 --exclude=apps/website \
5448 --exclude=apps/showcase \
5549 --exclude=apps/app \
56- --exclude=apps/doc \
50+ --exclude=apps/doc \
5751 --exclude=**/*.stories.* \
5852 . .
5953
@@ -69,35 +63,33 @@ RUN bun install
6963# Build every package in the workspace (uses the root "build" script)
7064RUN bun x turbo run build:ci --filter=./packages/@intlayer/mcp
7165
72- # Remove all dev dependencies
73- # RUN CI=true bun pm prune --production
74-
75- # Remove .ts, .tsx and .map files only within src/** directories, ignoring node_modules, so configuration files like intlayer.config.ts are kept
66+ # Strip source files to reduce image size
7667RUN find . -path "*/src/*" -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.map" \) -not -path "*/node_modules/*" -delete
7768
69+ # Runner — use oven/bun base image to avoid npm install overhead
70+ FROM node:22-alpine AS runner
71+
72+ RUN npm install -g bun@1.3.12
73+
74+
75+ WORKDIR /app
7876
7977ENV NODE_ENV=production
8078
81- # Create and use a non-root user for security
8279RUN addgroup -S app && adduser -S app -G app
8380
84- RUN chown -R app:app /workspace/packages/@intlayer/mcp
85-
86- WORKDIR /workspace/packages/@intlayer/mcp
81+ COPY --from=builder --chown= app:app /workspace/packages/@intlayer/mcp/dist ./dist
82+ COPY --from=builder --chown=app:app /workspace/packages/@intlayer/mcp/package.json ./package.json
83+ COPY --from=builder --chown=app:app /workspace/node_modules ./node_modules
8784
8885USER app
8986
9087# Expose the API port
9188EXPOSE 3000
9289
90+ HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
91+ CMD wget -qO- http://localhost:3000/health > /dev/null || exit 1
9392
94- HEALTHCHECK CMD true
95- # HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
96- # CMD \
97- # wget -qO- http://localhost:3000/health > /dev/null || exit 1
98-
99- # Option 1: Use mcp-proxy (recommended - simpler)
10093CMD ["bun" , "run" , "start:sse" ]
101-
10294# Option 2: Use stdio transport (alternative)
10395# CMD ["bun", "run", "start:stdio"]
0 commit comments