1
- # Basic Node.js Dockerfile
2
- FROM node:20-slim
1
+ # Build stage
2
+ FROM node:20-slim AS builder
3
3
4
4
WORKDIR /app
5
5
6
- # Install dependencies
7
- COPY browserbase/package.json browserbase/package-lock.json ./
8
- RUN npm ci --only=production
6
+ # Copy package files first for better layer caching
7
+ COPY package.json package-lock.json ./
9
8
10
- # Install dependencies
11
- RUN npm install
9
+ # Install all dependencies including dev dependencies for building
10
+ # --ignore-scripts prevents the prepare script from running prematurely
11
+ RUN npm ci --ignore-scripts
12
12
13
- # Copy the rest of the application source code
14
- COPY browserbase/ .
13
+ # Copy all source files
14
+ COPY . .
15
15
16
- # Build the TypeScript source code
17
- RUN npm run build
16
+ # Build the TypeScript source code manually instead of using the npm script
17
+ RUN npx tsc && npx shx chmod +x dist/*.js 2>/dev/null || echo "No executable JS files found"
18
18
19
- # Create the final image from a smaller Node.js runtime
19
+ # Production stage
20
20
FROM node:18-alpine
21
21
22
22
# Set the working directory
23
23
WORKDIR /app
24
24
25
- # Copy built files from the builder stage
25
+ # Copy package files
26
+ COPY package.json package-lock.json ./
27
+
28
+ # Install only production dependencies
29
+ # --ignore-scripts prevents the prepare script from running
30
+ RUN npm ci --omit=dev --ignore-scripts
31
+
32
+ # Copy built files from builder stage
26
33
COPY --from=builder /app/dist /app/dist
27
- COPY --from=builder /app/package.json /app/package.json
28
- COPY --from=builder /app/package-lock.json /app/package-lock.json
34
+ COPY --from=builder /app/cli.js /app/cli.js
35
+ COPY --from=builder /app/index.js /app/index.js
36
+ COPY --from=builder /app/index.d.ts /app/index.d.ts
37
+ COPY --from=builder /app/config.d.ts /app/config.d.ts
29
38
30
- # Define environment variables (can be overridden )
39
+ # Define environment variables (will be provided by Smithery )
31
40
ENV NODE_ENV=production
32
- ENV BROWSERBASE_API_KEY=<YOUR_BROWSERBASE_API_KEY>
33
- ENV BROWSERBASE_PROJECT_ID=<YOUR_BROWSERBASE_PROJECT_ID>
34
41
35
- # Expose a default port (useful if deploying as a service) 8931 is standard for sse mcp
42
+ # Expose a default port (useful if deploying as a service)
36
43
EXPOSE 8931
37
44
38
- CMD [ "node" , "cli.js" ]
45
+ # Command to run the application
46
+ CMD [ "node" , "cli.js" , "--port" , "8931" ]
0 commit comments