Skip to content

ci: build the preview apps in CI and let the image only package them - #3008

Merged
ins0 merged 2 commits into
mainfrom
ci/preview-build-on-runner
Aug 31, 2026
Merged

ci: build the preview apps in CI and let the image only package them#3008
ins0 merged 2 commits into
mainfrom
ci/preview-build-on-runner

Conversation

@ins0

@ins0 ins0 commented Aug 31, 2026

Copy link
Copy Markdown
Member

What & why

Both preview images built themselves: COPY . ., a second pnpm 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 install 25s
workspace dependency chain (tokens, icons, components + generators) 56s
next build compile 30s
generating 501 static pages, 3 workers 4.3 min
push 49s

The dependency chain is the part CI already has. The workflow now 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 build context, so the daemon receives the built output rather than 52MB of source it would ignore. deploy-main.yml builds 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/cache started empty every time.

Measured

Build the docs, on this branch, same commit:

.next/cache
before this PR, inside the image 358s (plus 25s install)
runner build cold 300s
runner build cold 270s
runner build warm 232s
runner build warm 240s

Two 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

  • PR title is a Conventional Commit and matches the base branch above
  • pnpm lint is clean
  • Generated code is committed — nothing generated changed
  • No user-facing strings
  • Docs unaffected

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>
@ins0
ins0 requested a review from a team August 31, 2026 06:42
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 76% 627 / 825
🔵 Statements 75.91% 643 / 847
🔵 Functions 77.95% 145 / 186
🔵 Branches 66.66% 298 / 447
File CoverageNo changed files found.
Generated in workflow #6434 for commit ea656b3 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3008.docs.review.flow-components.de
storybook pr-3008.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3008
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3008

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>
@ins0
ins0 merged commit 0046784 into main Aug 31, 2026
31 checks passed
@ins0
ins0 deleted the ci/preview-build-on-runner branch August 31, 2026 08:53
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.

2 participants