diff --git a/src/filesystem/Dockerfile b/src/filesystem/Dockerfile index 2addb6db..00b4cb49 100644 --- a/src/filesystem/Dockerfile +++ b/src/filesystem/Dockerfile @@ -6,11 +6,14 @@ COPY src/filesystem /app COPY tsconfig.json /tsconfig.json RUN --mount=type=cache,target=/root/.npm npm install - + +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + + FROM node:22-alpine AS release COPY --from=builder /app/dist /app - +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production WORKDIR /app diff --git a/src/gdrive/Dockerfile b/src/gdrive/Dockerfile index 43840db7..edc223c4 100644 --- a/src/gdrive/Dockerfile +++ b/src/gdrive/Dockerfile @@ -7,12 +7,15 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release -COPY --from=builder /app/dist /app - -ENV NODE_ENV=production - WORKDIR /app +COPY --from=builder /app/dist /app/dist +COPY --from=builder /app/node_modules /app/node_modules + +ENV NODE_ENV=production + CMD ["node", "dist/index.js"] \ No newline at end of file diff --git a/src/gdrive/README.md b/src/gdrive/README.md index 016b592d..1ef88b67 100644 --- a/src/gdrive/README.md +++ b/src/gdrive/README.md @@ -56,7 +56,7 @@ To integrate this server with the desktop app, add the following to your app's s "mcpServers": { "gdrive": { "command": "docker", - "args": ["run", "-i", "--rm", "ai/mcp-gdrive"] + "args": ["run", "-i", "--rm", "--mount", "type=bind,source=/Users/colinmcneil/Desktop/gcp-oauth.keys.json,target=/gcp-oauth.keys.json", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "ai/mcp-gdrive"] } } } diff --git a/src/gdrive/index.ts b/src/gdrive/index.ts index b9c6d910..deb8ec06 100644 --- a/src/gdrive/index.ts +++ b/src/gdrive/index.ts @@ -152,13 +152,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { const userQuery = request.params.arguments?.query as string; const escapedQuery = userQuery.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); const formattedQuery = `fullText contains '${escapedQuery}'`; - + const res = await drive.files.list({ q: formattedQuery, pageSize: 10, fields: "files(id, name, mimeType, modifiedTime, size)", }); - + const fileList = res.data.files ?.map((file: any) => `${file.name} (${file.mimeType})`) .join("\n"); @@ -175,7 +175,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { throw new Error("Tool not found"); }); -const credentialsPath = path.join( +const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join( path.dirname(new URL(import.meta.url).pathname), "../../../.gdrive-server-credentials.json", ); @@ -185,7 +185,7 @@ async function authenticateAndSaveCredentials() { const auth = await authenticate({ keyfilePath: path.join( path.dirname(new URL(import.meta.url).pathname), - "../../../gcp-oauth.keys.json", + process.env.GDRIVE_OAUTH_PATH || "../../../gcp-oauth.keys.json", ), scopes: ["https://www.googleapis.com/auth/drive.readonly"], }); diff --git a/src/github/Dockerfile b/src/github/Dockerfile index a94abccc..20f4ff38 100644 --- a/src/github/Dockerfile +++ b/src/github/Dockerfile @@ -8,9 +8,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production diff --git a/src/gitlab/Dockerfile b/src/gitlab/Dockerfile index 79caaef0..83e470b6 100644 --- a/src/gitlab/Dockerfile +++ b/src/gitlab/Dockerfile @@ -7,9 +7,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production diff --git a/src/google-maps/Dockerfile b/src/google-maps/Dockerfile index ca8a7dd5..24598a6d 100644 --- a/src/google-maps/Dockerfile +++ b/src/google-maps/Dockerfile @@ -8,9 +8,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production diff --git a/src/memory/Dockerfile b/src/memory/Dockerfile index 0bbfa8ef..23f9304d 100644 --- a/src/memory/Dockerfile +++ b/src/memory/Dockerfile @@ -7,9 +7,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production diff --git a/src/postgres/Dockerfile b/src/postgres/Dockerfile index 70fec576..d9f8d0c7 100644 --- a/src/postgres/Dockerfile +++ b/src/postgres/Dockerfile @@ -7,10 +7,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app - +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production WORKDIR /app diff --git a/src/sequentialthinking/Dockerfile b/src/sequentialthinking/Dockerfile index 3f35b543..38c742c1 100644 --- a/src/sequentialthinking/Dockerfile +++ b/src/sequentialthinking/Dockerfile @@ -7,9 +7,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production diff --git a/src/slack/Dockerfile b/src/slack/Dockerfile index aed894ef..103579f6 100644 --- a/src/slack/Dockerfile +++ b/src/slack/Dockerfile @@ -8,9 +8,12 @@ WORKDIR /app RUN --mount=type=cache,target=/root/.npm npm install +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + FROM node:22-alpine AS release COPY --from=builder /app/dist /app +COPY --from=builder /app/node_modules /app/node_modules ENV NODE_ENV=production