ci: build the preview apps in CI and let the image only package them - #3008
Merged
Conversation
Both images built themselves: `COPY . .`, a second `pnpm install`, and the whole workspace rebuilt against an nx cache that is empty inside a container. A docs preview took 449s — 25s install, 56s dependency chain, 30s compile, 4.3 minutes generating the 501 static pages, 49s push. The dependency chain is the part CI already has: the workflow builds the app with the nx cache `main` seeds, and the Dockerfile is reduced to nginx plus the output beside it. Each image also gets its own context, so the daemon receives the built output instead of 52MB of source it would ignore. Same change in `deploy-main.yml`, which builds the same two images. This does not touch the static export, which is three quarters of the docs build and where the remaining time is. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Coverage Report for ./packages/components/
File CoverageNo changed files found. |
Contributor
🚀 Preview DeploymentPreview environments are ready:
Images:
|
Measuring whether it moves the static export, which is three quarters of the docs build and what the previous commit deliberately did not touch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Lisa18289
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Both preview images built themselves:
COPY . ., a secondpnpm install, and the whole workspace rebuilt against an nx cache that is empty inside a container. Measured on a preview before this PR, the docs image took 449s:COPY . .+pnpm installnext buildcompileThe dependency chain is the part CI already has. The workflow now builds the app with the nx cache
mainseeds, and the Dockerfile is reduced to nginx plus the output beside it. Each image also gets its own build context, so the daemon receives the built output rather than 52MB of source it would ignore.deploy-main.ymlbuilds the same two images and gets the same change.Building on the runner is also what makes Next's own cache reusable: inside the image
.next/cachestarted empty every time.Measured
Build the docs, on this branch, same commit:.next/cacheTwo samples per state, because the cold pair alone spreads 30s — the ~50s between the groups is larger than the spread inside them, and both warm runs land together.
Whole jobs: docs 459s → 340-355s, storybook 124s → 91s.
The static export is still three quarters of the docs build and is untouched by any of this. What is left to try there is more cores (it runs 501 pages on 3 workers, and unlike the visual suite it parallelises), or generating fewer pages — both decisions for the team rather than a CI change.
Checklist
pnpm lintis clean