Split production node_modules

This commit is contained in:
colinmcneil 2024-12-17 14:56:25 -05:00 • committed by Jim Clark
commit 4e8a8d270a
No known key found for this signature in database
GPG key ID: 73305B2338AAA7BE
14 changed files with 89 additions and 44 deletions

View file

@ -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"]

View file

@ -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"]

View file

@ -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"]

View file

@ -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"]

View file

@ -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
ENV NODE_ENV=production
WORKDIR /app
CMD ["node", "dist/index.js"]
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
RUN npm ci --ignore-scripts --omit-dev
ENTRYPOINT ["node", "dist/index.js"]

View file

@ -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"]

View file

@ -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"],
});

View file

@ -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"]

View file

@ -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
COPY --from=builder /app/dist /app
COPY --from=builder /app/node_modules /app/node_modules
ENV NODE_ENV=production
FROM node:22.12-alpine AS release
WORKDIR /app
CMD ["node", "dist/index.js"]
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
RUN npm ci --ignore-scripts --omit-dev
ENTRYPOINT ["node", "dist/index.js"]

View file

@ -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"]

View file

@ -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"]

View file

@ -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"]

View file

@ -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"]

View file

@ -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"]