Skip to content

build(web): single compiled Dockerfile for the Fresh frontend#5

Merged
poly-glot merged 2 commits into
mainfrom
chore/web-compile-single-dockerfile
Jun 6, 2026
Merged

build(web): single compiled Dockerfile for the Fresh frontend#5
poly-glot merged 2 commits into
mainfrom
chore/web-compile-single-dockerfile

Conversation

@poly-glot

Copy link
Copy Markdown
Owner

Consolidates the web image to one Dockerfile.web built with Fresh's deno compile recipe (replaces the deno serve approach; the old Dockerfile.web.compile is removed).

Changes

  • Dockerfile.web: deno task builddeno compile _fresh/compiled-entry.js into one self-contained glibc binary. Drops node_modules before compiling (SSR bundle is self-contained) → binary ~83 MB, image 274 MB. Bakes in --unstable-kv + --include static, creates the KV dir.
  • lib/server-entry-css.ts: read the vite manifest relative to import.meta.dirname instead of cwd, so the shared admin/form CSS links under both deno serve and a compiled binary (which extracts embedded files to a temp dir).

Compatibility

  • Drop-in for deployment/base/web.yaml: no command override, port 8000, /healthz probes, KV_PATH/DMOZDB_HOST via env. No manifest change.
  • cd.yaml already builds Dockerfile.web — no CI change.

Verification (local, full stack)

  • with-cookie / → 200, /healthz → 200, /favicon.ico → 200 (embedded static), 0 runtime errors.
  • Alpine ruled out: deno compile emits glibc-only binaries (no musl target).

Caveat: local test used a local KV file; prod uses remote denokv (same runtime/flags/code as the prior deno serve image, so expected identical).

poly-glot added 2 commits June 6, 2026 13:23
The vite server manifest was read from the cwd-relative path
_fresh/server/.vite/manifest.json, which only resolves under `deno serve`
(cwd=web/). A `deno compile` binary extracts embedded files to a temp dir, so
the read failed and the shared admin/form-component stylesheet was never
linked. Resolve it relative to import.meta.dirname so it works under both.
Replace the `deno serve` web image with Fresh's deno-compile recipe: deno task
build, then deno compile _fresh/compiled-entry.js into one glibc binary that
embeds the runtime, bundle, and static assets. Drop node_modules before
compiling (the SSR bundle is self-contained) so the binary stays ~83MB; bake in
--unstable-kv and --include static, and create the KV dir. Consolidates the
former Dockerfile.web.compile into the single Dockerfile.web that cd.yaml builds.
@poly-glot
poly-glot merged commit d021b75 into main Jun 6, 2026
2 checks passed
@poly-glot
poly-glot deleted the chore/web-compile-single-dockerfile branch June 6, 2026 12:28
poly-glot added a commit that referenced this pull request Jun 7, 2026
build(web): single compiled Dockerfile for the Fresh frontend
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.

1 participant