Skip to content

Commit

Permalink
Split production node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinMcNeil authored and slimslenderslacks committed Dec 19, 2024
1 parent 9ff603a commit 4e8a8d2
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 44 deletions.
10 changes: 7 additions & 3 deletions src/aws-kb-retrieval-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]
10 changes: 7 additions & 3 deletions src/brave-search/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]
10 changes: 8 additions & 2 deletions src/everart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]

CMD ["node", "dist/index.js"]
8 changes: 6 additions & 2 deletions src/everything/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
12 changes: 8 additions & 4 deletions src/filesystem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]
7 changes: 5 additions & 2 deletions src/gdrive/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ FROM node:22-alpine AS release
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
4 changes: 2 additions & 2 deletions src/gdrive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join(
async function authenticateAndSaveCredentials() {
console.log("Launching auth flow…");
const auth = await authenticate({
keyfilePath: path.join(
keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join(
path.dirname(new URL(import.meta.url).pathname),
process.env.GDRIVE_OAUTH_PATH || "../../../gcp-oauth.keys.json",
"../../../gcp-oauth.keys.json",
),
scopes: ["https://www.googleapis.com/auth/drive.readonly"],
});
Expand Down
13 changes: 7 additions & 6 deletions src/github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ 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.12-alpine AS release

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
13 changes: 8 additions & 5 deletions src/gitlab/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ 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.12-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]
9 changes: 6 additions & 3 deletions src/google-maps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
9 changes: 6 additions & 3 deletions src/memory/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
10 changes: 7 additions & 3 deletions src/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
9 changes: 6 additions & 3 deletions src/sequentialthinking/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
9 changes: 6 additions & 3 deletions src/slack/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --om

FROM node:22-alpine AS release

COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

WORKDIR /app

CMD ["node", "dist/index.js"]
RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]

0 comments on commit 4e8a8d2

Please sign in to comment.