Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
McCio
force-pushed
the
fix/docker-layering
branch
from
July 19, 2026 17:08
fafe55f to
ff347d8
Compare
Contributor
Author
|
@saberzero1 I see you are working on main branch on the dockerfile. should I realign this? I really think this should be merged, among the other things it reduced the final image size to just ~500MB instead of ~1.5GB |
… cache mounts, .dockerignore
McCio
force-pushed
the
fix/docker-layering
branch
from
August 5, 2026 18:26
ff347d8 to
f923b21
Compare
This branch was successfully deployed
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.
I noticed rebuilds were slow since npm install and plugin install shared a layer, so changing one busted the other. Pulling the image was also slow as everything was bundled together.
I initially split into three stages (builder, plugins, runtime) to cache npm and plugin install independently, then revised to two stages after realising that plugins with
requiresInstalladd native deps to rootnode_modules, so copying node_modules from a stage that skipped plugin install would silently drop those.The builder stage now runs both
npm ciand plugin install, each as its own layer, so the npm cache still survives a plugin-only change. The runtime stage copies node_modules and .quartz from builder.I also added
ENV NPM_CONFIG_USERCONFIG=/usr/src/app/.npmrcsince plugin install can spawn child npm processes inside.quartz/plugins/<name>/, which would miss the root .npmrc otherwise, plus apt cache mounts to keep the apt cache out of the layers, a .dockerignore to keep node_modules and .quartz out of the build context, and glob patterns on quartz.lock.json and quartz.config.yaml.