Skip to content

Commit 22acc1d

Browse files
committed
feat: add Dockerfile and env.json
1 parent 87252e4 commit 22acc1d

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ---- Builder Stage ----
2+
FROM node:22-slim AS builder
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Install dependencies
8+
# Copy package files first for better caching
9+
COPY package.json package-lock.json* ./
10+
# Install all dependencies (including devDependencies needed for build)
11+
RUN npm install --production=false
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the application
17+
RUN npm run build
18+
19+
# Remove devDependencies after build
20+
RUN npm prune --production
21+
22+
23+
# ---- Final Stage ----
24+
FROM node:22-slim
25+
26+
ENV NODE_ENV=production \
27+
PATH="/home/service-user/.local/bin:${PATH}"
28+
29+
# Install mcp-proxy globally for runtime use
30+
# Combine update, install, and clean in one layer
31+
RUN apt-get update && \
32+
apt-get install -y --no-install-recommends curl && \
33+
npm install -g [email protected] && \
34+
npm cache clean --force && \
35+
apt-get purge -y --auto-remove curl && \
36+
apt-get clean && \
37+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
38+
39+
# Create non-root user and group
40+
# Create app directory and set permissions
41+
RUN groupadd --system --gid 1987 service-user && \
42+
useradd --system --uid 1987 --gid service-user -m service-user && \
43+
mkdir -p /app && \
44+
chown -R service-user:service-user /app
45+
46+
# Set working directory
47+
WORKDIR /app
48+
49+
# Copy necessary artifacts from builder stage
50+
COPY --from=builder --chown=service-user:service-user /app/package.json ./package.json
51+
COPY --from=builder --chown=service-user:service-user /app/node_modules ./node_modules
52+
COPY --from=builder --chown=service-user:service-user /app/build ./build
53+
54+
# Switch to non-root user
55+
USER service-user
56+
57+
# Expose port if necessary (Update port number if your app uses a different one)
58+
# EXPOSE 3000
59+
60+
# Define the command to run the application
61+
# CMD ["mcp-proxy", "node", "build/index.js"] # Keep original for reference
62+
CMD ["mcp-proxy", "node", "build/index.js"]

env.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"properties": {
3+
"MAX_TOKENS": {
4+
"default": "20000",
5+
"description": "Maximum tokens per response",
6+
"type": "string"
7+
},
8+
"NODE_ENV": {
9+
"default": "production",
10+
"description": "The Node.js environment setting",
11+
"type": "string"
12+
},
13+
"OBSIDIAN_API_KEY": {
14+
"description": "Your API key for the Obsidian MCP Server",
15+
"type": "string"
16+
},
17+
"OBSIDIAN_VERIFY_SSL": {
18+
"default": "false",
19+
"description": "Enable SSL verification",
20+
"type": "string"
21+
},
22+
"RATE_LIMIT_MAX_REQUESTS": {
23+
"default": "200",
24+
"description": "Max requests per rate limit window",
25+
"type": "string"
26+
},
27+
"RATE_LIMIT_WINDOW_MS": {
28+
"default": "900000",
29+
"description": "Rate limit window in milliseconds (default: 15 minutes)",
30+
"type": "string"
31+
},
32+
"TOOL_TIMEOUT_MS": {
33+
"default": "60000",
34+
"description": "Tool execution timeout in milliseconds",
35+
"type": "string"
36+
}
37+
},
38+
"required": [
39+
"OBSIDIAN_API_KEY"
40+
],
41+
"type": "object"
42+
}

0 commit comments

Comments
 (0)