Skip to content

feat(docker): official Vite+ toolchain image#1944

Draft
fengmk2 wants to merge 12 commits into
mainfrom
docker-image
Draft

feat(docker): official Vite+ toolchain image#1944
fengmk2 wants to merge 12 commits into
mainfrom
docker-image

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Implements the official Vite+ Docker image from the RFC (rfcs/docker-image.md).

vp already provisions the exact Node.js from .node-version, so one toolchain image builds any project (no Node-version-keyed tags). It is not a production runtime image: a documented multi-stage build copies the resolved Node.js into a small, vp-free runtime stage.

Changes

  • docker/Dockerfile: glibc (debian:bookworm-slim) image bundling vp + native build toolchain, non-root user.
  • release.yml: publish-docker job, multi-arch (amd64/arm64) push to ghcr.io/voidzero-dev/vite-plus after npm publish, version-tagged.
  • docs/guide/docker.md + sidebar: multi-stage runtime, static SPA, CI, devcontainer, ad-hoc usage.

Verified locally: .node-version=24.15.0 resolves and installs exactly v24.15.0; the copied Node runs standalone in a plain debian:bookworm-slim stage.

Note: the first publish needs the GHCR package made public / linked to the repo in org settings.

Closes #1490

@fengmk2 fengmk2 self-assigned this Jun 25, 2026
@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 2a8fefc
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a3cf781d0e5d900082a8c02
😎 Deploy Preview https://deploy-preview-1944--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

fengmk2 added 3 commits June 25, 2026 14:00
Propose an official Vite+ toolchain Docker image on GHCR that bundles the
vp CLI for the build/CI/dev phases, plus a documented multi-stage pattern
that copies the exact .node-version Node into a slim glibc runtime (no vp),
keeping deployed images small while honoring the project's pinned Node.

Refs #1490, #1324
The image installs vp from npm via the official install script (pinned
VP_VERSION) and publishes after the npm release, rather than copying release
artifacts. Mark the RFC accepted with implementation in progress.
Add docker/Dockerfile for the official Vite+ toolchain image: a glibc
(debian:bookworm-slim) image that bundles the vp CLI for the build, CI, and
development phases. vp provisions the exact Node.js from .node-version at build
time, so the image is version-agnostic and needs no Node-keyed tags.

Add a publish-docker job to release.yml that builds the multi-arch
(amd64/arm64) image and pushes it to ghcr.io/voidzero-dev/vite-plus, tagged by
vp version, after the npm release is published.

Add docs/guide/docker.md documenting the recommended multi-stage pattern that
copies the resolved Node.js into a small, vp-free production runtime image,
plus static-SPA, CI, devcontainer, and ad-hoc usage.

Refs #1490
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 2a8fefc

fengmk2 added 9 commits June 25, 2026 14:10
Add a publish-docker-preview job to publish-to-pkg.pr.new.yml that builds the
multi-arch image from the PR's pkg.pr.new build (VP_PR_VERSION) and pushes it as
ghcr.io/voidzero-dev/vite-plus:pr-<number>, so the image can be verified before
a real release.

Teach docker/Dockerfile an optional VP_PR_VERSION build arg, which installs vp
from pkg.pr.new instead of npm.

Refs #1490
Fixes vp check formatting failures in docs/guide/docker.md and
rfcs/docker-image.md (table alignment and emphasis markers).
- Drop xz-utils: vp only extracts .tar.gz (gzip), never xz.
- Drop redundant `mkdir -p /app && chown`: WORKDIR /app under USER vp already
  creates it owned by vp (verified).
- Combine the two ENV instructions into one layer.
- Build the per-PR preview image for linux/amd64 only; arm64 is covered by the
  release build and the test-install-sh-arm64 job, avoiding the slow QEMU leg
  on every labeled PR.
Reference why-reproductions-are-required/vite-plus-docker-example, which
CI-verifies the documented Dockerfile patterns end to end.
Running vp install --prod after a full vp install does not prune the
already-installed devDependencies (the large vite-plus toolchain), so the docs
pattern shipped ~164MB of dev toolchain into the runtime via COPY node_modules.
Install production dependencies in a dedicated deps stage (fresh --prod) instead,
and note that self-contained bundles can skip node_modules entirely. Also fix
the runtime size claim (smaller than the default node:* image, not -slim).
The installer pre-provisions a default Node.js (~190MB), but each project
provisions its own pinned Node at build time, so the default is dead weight in a
builder image. Remove it (rm -rf $VP_HOME/js_runtime) in the install layer; the
node/npm/npx shims remain and fetch the right version on first use. Toolchain
image: ~1.04GB -> ~846MB, more than an Alpine switch would save and without the
musl tradeoffs.
Publish an opt-in Alpine variant under -alpine tags (docker/Dockerfile.alpine),
built via a debian+alpine matrix in both the release and pkg.pr.new preview
workflows. It yields the smallest runtime (Alpine SSR ~136MB vs ~150MB
distroless, ~198MB debian-slim) for teams that standardize on Alpine.

Document the musl tradeoffs loudly: Node comes from the unofficial, unsigned
musl builds; native addons may need musl prebuilds or source compilation; and a
musl Node binary only runs on a musl base, so the runtime stage must also be
Alpine. The Debian image stays the recommended default.
Switch the example tags from the fictional :1 to the real 0.x scheme (:0, :0.2,
:0.2.2 and -alpine variants), since 0.2.2 is the first published image. Add a
link to the GitHub package page to browse all published versions and digests.
@pkg-pr-new

pkg-pr-new Bot commented Jun 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

vite-plus

npm i https://pkg.pr.new/voidzero-dev/vite-plus@1944

@voidzero-dev/vite-plus-core

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-core@1944

@voidzero-dev/vite-plus-prompts

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-prompts@1944

@voidzero-dev/vite-plus-cli-darwin-arm64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-darwin-arm64@1944

@voidzero-dev/vite-plus-cli-darwin-x64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-darwin-x64@1944

@voidzero-dev/vite-plus-cli-linux-arm64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-arm64-gnu@1944

@voidzero-dev/vite-plus-cli-linux-arm64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-arm64-musl@1944

@voidzero-dev/vite-plus-cli-linux-x64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-x64-gnu@1944

@voidzero-dev/vite-plus-cli-linux-x64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-x64-musl@1944

@voidzero-dev/vite-plus-cli-win32-arm64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-win32-arm64-msvc@1944

@voidzero-dev/vite-plus-cli-win32-x64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-win32-x64-msvc@1944

@voidzero-dev/vite-plus-darwin-arm64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-darwin-arm64@1944

@voidzero-dev/vite-plus-darwin-x64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-darwin-x64@1944

@voidzero-dev/vite-plus-linux-arm64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-arm64-gnu@1944

@voidzero-dev/vite-plus-linux-arm64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-arm64-musl@1944

@voidzero-dev/vite-plus-linux-x64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-x64-gnu@1944

@voidzero-dev/vite-plus-linux-x64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-x64-musl@1944

@voidzero-dev/vite-plus-win32-arm64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-win32-arm64-msvc@1944

@voidzero-dev/vite-plus-win32-x64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-win32-x64-msvc@1944

commit: 2a8fefc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: official Docker image that honors .node-version

1 participant