forked from ivo-toby/mcp-openapi-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (35 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
46 lines (35 loc) · 1.37 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
43
44
45
46
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node.js image as the base image
FROM node:22-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy package files and source code
COPY . .
# Install dependencies
RUN --mount=type=cache,target=/root/.npm npm install
# Build the application
RUN npm run build
# Use a smaller Node.js image for the runtime
FROM node:22-alpine AS runtime
# Set the working directory
WORKDIR /app
# Copy built files from the builder stage
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/bin /app/bin
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/example-spec.json /app/example-spec.json
# Set environment variables for the MCP server
ENV API_BASE_URL="https://api.example.com"
ENV OPENAPI_SPEC_FROM_STDIN="true"
ENV TRANSPORT_TYPE="stdio"
ENV SERVER_NAME="mcp-openapi-server"
ENV SERVER_VERSION="1.0.0"
# Create a startup script that pipes the example spec to stdin
RUN echo '#!/bin/sh' > /app/start-server.sh && \
echo 'cat /app/example-spec.json | node /app/bin/mcp-server.js' >> /app/start-server.sh && \
chmod +x /app/start-server.sh
# Expose any required ports (if needed by the application)
# EXPOSE 3000
# Start the server with stdin spec
ENTRYPOINT ["/app/start-server.sh"]