Skip to content

Commit 90eae18

Browse files
chore(internal): always generate MCP server dockerfiles and upgrade associated dependencies
1 parent 61a5d88 commit 90eae18

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

.dockerignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Dependencies
2+
node_modules/
3+
**/node_modules/
4+
5+
# Build outputs
6+
dist/
7+
**/dist/
8+
9+
# Git
10+
.git/
11+
.gitignore
12+
13+
# CI/CD
14+
.github/
15+
.gitlab-ci.yml
16+
.travis.yml
17+
18+
# IDE
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Testing
30+
test/
31+
tests/
32+
__tests__/
33+
*.test.js
34+
*.spec.js
35+
coverage/
36+
.nyc_output/
37+
38+
# Logs
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
44+
# Environment
45+
.env
46+
.env.*
47+
48+
# Temporary files
49+
*.tmp
50+
*.temp
51+
.cache/
52+
53+
# Examples and scripts
54+
examples/
55+
bin/
56+
57+
# Other packages (we only need mcp-server)
58+
packages/*/
59+
!packages/mcp-server/

packages/mcp-server/Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Dockerfile for Image Kit MCP Server
2+
#
3+
# This Dockerfile builds a Docker image for the MCP Server.
4+
#
5+
# To build the image locally:
6+
# docker build -f packages/mcp-server/Dockerfile -t @imagekit/api-mcp:local .
7+
#
8+
# To run the image:
9+
# docker run -i @imagekit/api-mcp:local [OPTIONS]
10+
#
11+
# Common options:
12+
# --tool=<name> Include specific tools
13+
# --resource=<name> Include tools for specific resources
14+
# --operation=read|write Filter by operation type
15+
# --client=<type> Set client compatibility (e.g., claude, cursor)
16+
# --transport=<type> Set transport type (stdio or http)
17+
#
18+
# For a full list of options:
19+
# docker run -i @imagekit/api-mcp:local --help
20+
#
21+
# Note: The MCP server uses stdio transport by default. Docker's -i flag
22+
# enables interactive mode, allowing the container to communicate over stdin/stdout.
23+
24+
# Build stage
25+
FROM node:24-alpine AS builder
26+
27+
# Install bash for build script
28+
RUN apk add --no-cache bash openssl
29+
30+
# Set working directory
31+
WORKDIR /build
32+
33+
# Copy entire repository
34+
COPY . .
35+
36+
# Install all dependencies and build everything
37+
RUN yarn install --frozen-lockfile && \
38+
yarn build
39+
40+
# Production stage
41+
FROM node:24-alpine
42+
43+
# Add non-root user
44+
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
45+
46+
# Set working directory
47+
WORKDIR /app
48+
49+
# Copy the built mcp-server dist directory
50+
COPY --from=builder /build/packages/mcp-server/dist ./
51+
52+
# Copy node_modules from mcp-server (includes all production deps)
53+
COPY --from=builder /build/packages/mcp-server/node_modules ./node_modules
54+
55+
# Copy the built @imagekit/nodejs into node_modules
56+
COPY --from=builder /build/dist ./node_modules/@imagekit/nodejs
57+
58+
# Change ownership to nodejs user
59+
RUN chown -R nodejs:nodejs /app
60+
61+
# Switch to non-root user
62+
USER nodejs
63+
64+
# The MCP server uses stdio transport by default
65+
# No exposed ports needed for stdio communication
66+
67+
# Set the entrypoint to the MCP server
68+
ENTRYPOINT ["node", "index.js"]
69+
70+
# Allow passing arguments to the MCP server
71+
CMD []

0 commit comments

Comments
 (0)