Update dockerfiles for npx versions, gdrive env credential paths

This commit is contained in:
colinmcneil 2024-12-17 13:15:58 -05:00 • committed by Jim Clark
commit 9ff603aef5
No known key found for this signature in database
GPG key ID: 73305B2338AAA7BE
11 changed files with 37 additions and 11 deletions

View file

@ -7,10 +7,13 @@ COPY tsconfig.json /tsconfig.json
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production
WORKDIR /app WORKDIR /app

View file

@ -7,12 +7,15 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app
ENV NODE_ENV=production
WORKDIR /app 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"] CMD ["node", "dist/index.js"]

View file

@ -56,7 +56,7 @@ To integrate this server with the desktop app, add the following to your app's s
"mcpServers": { "mcpServers": {
"gdrive": { "gdrive": {
"command": "docker", "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"]
} }
} }
} }

View file

@ -175,7 +175,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
throw new Error("Tool not found"); 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), path.dirname(new URL(import.meta.url).pathname),
"../../../.gdrive-server-credentials.json", "../../../.gdrive-server-credentials.json",
); );
@ -185,7 +185,7 @@ async function authenticateAndSaveCredentials() {
const auth = await authenticate({ const auth = await authenticate({
keyfilePath: path.join( keyfilePath: path.join(
path.dirname(new URL(import.meta.url).pathname), 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"], scopes: ["https://www.googleapis.com/auth/drive.readonly"],
}); });

View file

@ -8,9 +8,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production

View file

@ -7,9 +7,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production

View file

@ -8,9 +8,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production

View file

@ -7,9 +7,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production

View file

@ -7,10 +7,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production
WORKDIR /app WORKDIR /app

View file

@ -7,9 +7,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production

View file

@ -8,9 +8,12 @@ WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install 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 FROM node:22-alpine AS release
COPY --from=builder /app/dist /app COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production ENV NODE_ENV=production