forked from windsornguyen/brave-search-mcp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
42 lines (30 loc) · 1.16 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
# Use official Node.js runtime as base image
FROM public.ecr.aws/docker/library/node:22-alpine
# Set working directory inside container
WORKDIR /app
# Copy package files first for better caching
COPY package.json package-lock.json* ./
# Install dependencies without running postinstall scripts to avoid build failures
RUN npm install --ignore-scripts
# Install TypeScript globally for running .ts files directly
RUN npm install -g typescript ts-node
# Copy source code
COPY . .
# Build the TypeScript code - handle gracefully if build fails
RUN npm run build || echo "Build step failed, but continuing..."
# Create a non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S mcp -u 1001
# Change ownership of app directory to non-root user
RUN chown -R mcp:nodejs /app
# Switch to non-root user
USER mcp
# Set environment variables for Lambda Web Adapter
ENV NODE_ENV=production
ENV PORT=8000
ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/extensions/lambda-adapter
# Expose port 8000 for the MCP server
EXPOSE 8000
# Command to run the server
# Use compiled JavaScript for production, with --port flag for HTTP transport
CMD ["node", "dist/index.js", "--port", "8000"]