Skip to content

[nodejs] use npm ci to speed up docker builds#6812

Merged
rochdev merged 6 commits intomainfrom
rochdev/npm-ci
Apr 29, 2026
Merged

[nodejs] use npm ci to speed up docker builds#6812
rochdev merged 6 commits intomainfrom
rochdev/npm-ci

Conversation

@rochdev
Copy link
Copy Markdown
Member

@rochdev rochdev commented Apr 25, 2026

Motivation

Using npm install and then install static versions manually afterwards is much slower than just having everything in the lockfile and using npm ci.

Changes

Use npm ci to speed up docker builds.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 25, 2026

CODEOWNERS have been resolved as:

utils/build/docker/nodejs/express4/package-lock.json                    @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express4/package.json                         @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express5/package-lock.json                    @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express5/package.json                         @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/function/package-lock.json             @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_otel/express4-otel/package-lock.json          @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_otel/express4-otel/package.json               @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/anthropic-js.Dockerfile                       @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express4-typescript.Dockerfile                @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express4.Dockerfile                           @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/express5.Dockerfile                           @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/fastify.Dockerfile                            @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/google_genai-js.Dockerfile                    @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/nextjs.Dockerfile                             @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/nextjs/next.config.js                         @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/openai-js.Dockerfile                          @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs/uds-express4.Dockerfile                       @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/nodejs-alb-multi.Dockerfile            @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/nodejs-alb.Dockerfile                  @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/nodejs-apigw-http.Dockerfile           @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/nodejs-apigw-rest.Dockerfile           @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_lambda/nodejs-function-url.Dockerfile         @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/nodejs_otel/express4-otel.Dockerfile                 @DataDog/dd-trace-js @DataDog/system-tests-core

@rochdev rochdev marked this pull request as ready for review April 26, 2026 19:42
@rochdev rochdev requested review from a team as code owners April 26, 2026 19:42
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a47ebf6f9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread utils/build/docker/nodejs_lambda/nodejs-alb.Dockerfile Outdated
@datadog-datadog-prod-us1-2

This comment has been minimized.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there no package.json before ? how were the dependencies installed ? whaaat ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were installed manually with npm install <pkg>@<version>, which means going through a whole new resolve again, regenerating the lockfile, redownloading some dependencies, etc. It was very inefficient.

// Disabled because standalone mode does not support using modules directly
// from node_modules which is necessary when using `npm link dd-trace`.
// output: 'standalone'
outputFileTracing: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Output File Tracing is a Next.js feature (introduced in version 12) that automatically analyzes your application during the next build process to determine exactly which files and dependencies are required to run a production server."

For our purpose, it just takes double the time for no benefit.

Copy link
Copy Markdown
Member

@simon-id simon-id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preemptive approval because i'm going in vacations tonight but please respond to my comments

@rochdev rochdev enabled auto-merge (squash) April 29, 2026 13:07
@rochdev rochdev merged commit d982427 into main Apr 29, 2026
707 checks passed
@rochdev rochdev deleted the rochdev/npm-ci branch April 29, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants