-
Notifications
You must be signed in to change notification settings - Fork 217
feat(docker): official Vite+ toolchain image #1944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fengmk2
wants to merge
27
commits into
main
Choose a base branch
from
docker-image
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
c7b7cb0
docs(rfc): add official Docker image RFC
fengmk2 d5f7bda
docs(rfc): reflect install-script image build in Docker RFC
fengmk2 143347c
feat(docker): add official Vite+ toolchain image
fengmk2 45d9efd
ci(docker): build a preview image from pkg.pr.new
fengmk2 53e0aa7
style(docker): apply oxfmt formatting to Docker docs and RFC
fengmk2 bee12c5
refactor(docker): simplify image and speed up preview build
fengmk2 b39bcfb
docs(rfc): link the docs-example verification repo
fengmk2 0706d42
docs(docker): prune prod deps in a separate stage
fengmk2 05c6a7c
feat(docker): drop the baked default Node from the toolchain image
fengmk2 7e315a5
feat(docker): add Alpine (musl) toolchain image variant
fengmk2 b7159e2
docs(docker): note building a static SPA with the Alpine toolchain
fengmk2 dfef4fa
docs(docker): use 0.2.2 (first Docker release) in examples
fengmk2 7d4d5b9
docs(docker): COPY --chown=vp:vp in multi-stage examples
fengmk2 2a227ec
ci(docker): post a sticky PR comment with preview image tags
fengmk2 9883ff7
chore(docker): clarify comment-body form and add Dockerfile sync notes
fengmk2 3a59ef9
ci(docker): show preview image sizes in the sticky PR comment
fengmk2 bfb0436
docs(docker): use a text link for the GitHub package page
fengmk2 4786a7e
docs(docker): use :latest in examples instead of pinned versions
fengmk2 c66295d
docs(docker): don't require .node-version in the dependency COPY
fengmk2 ff20dd1
ci(docker): measure preview size via manifest inspect; drop redundant…
fengmk2 a67c9d9
docs(docker): optional .node-version glob; clarify latest vs pin
fengmk2 85b5692
feat(docker): add openssh-client and own /app for the vp user
fengmk2 36989b2
ci(release): make the Discord notification non-blocking
fengmk2 91b8f02
ci(release): notify Discord after Docker publish, include GHCR image
fengmk2 698d425
ci(release): drop redundant Release from discord-notify needs
fengmk2 7fb1189
docs(docker): use Node.js (not bare Node) per official naming
fengmk2 3030eee
docs(rfc): remove Status line from Docker image RFC
fengmk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # Official Vite+ toolchain image. | ||
| # | ||
| # Bundles the `vp` CLI for the build, CI, and development phases. This is NOT a | ||
| # production runtime image: it ships the full toolchain (vite, rolldown, vitest, | ||
| # oxlint, ...) and is meant for use as a build stage, CI image, or devcontainer. | ||
| # | ||
| # For production, use the documented multi-stage pattern (see docs/guide/docker.md) | ||
| # where this image builds the app and the exact Node.js resolved from | ||
| # `.node-version` is copied into a small, vp-free runtime stage. | ||
|
|
||
| FROM debian:bookworm-slim | ||
|
|
||
| LABEL org.opencontainers.image.source="https://github.com/voidzero-dev/vite-plus" \ | ||
| org.opencontainers.image.description="Vite+ toolchain image (vp CLI) for build, CI, and development" \ | ||
| org.opencontainers.image.licenses="MIT" | ||
|
|
||
| # Version of vp to install. Override at build time: | ||
| # docker build --build-arg VP_VERSION=1.4.2 . | ||
| ARG VP_VERSION=latest | ||
|
|
||
| # Optional: build a preview image from a pkg.pr.new build instead of npm. | ||
| # Set to a PR number or commit SHA; when set it overrides VP_VERSION. | ||
| # docker build --build-arg VP_PR_VERSION=1569 . | ||
| ARG VP_PR_VERSION= | ||
|
|
||
| # Toolchain image: include git (+ openssh-client for git+ssh dependencies) and a | ||
| # C/C++ build toolchain so native addons (for example better-sqlite3 or sharp) | ||
| # can compile during `vp install`. | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
|
fengmk2 marked this conversation as resolved.
|
||
| openssh-client \ | ||
| build-essential \ | ||
| python3 \ | ||
| pkg-config \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && useradd --create-home --shell /bin/bash vp \ | ||
| # Own /app for the vp user so downstream `WORKDIR /app` + `vp install` can write. | ||
| && mkdir -p /app \ | ||
| && chown vp:vp /app | ||
|
|
||
| # Run as a non-root user by default (mirrors oven/bun's `bun` and Deno's `deno`). | ||
| USER vp | ||
|
|
||
| ENV VP_HOME=/home/vp/.vite-plus \ | ||
| PATH=/home/vp/.vite-plus/bin:$PATH | ||
|
|
||
| # Install the vp global CLI. The installer downloads the platform package from | ||
| # npm (or from pkg.pr.new when VP_PR_VERSION is set). Node.js itself is | ||
| # provisioned per-project by vp at build time, honoring `.node-version` / | ||
| # `engines.node` / `devEngines.runtime`. | ||
| # | ||
| # The installer pre-provisions a default Node.js (~190 MB). Drop it: each project | ||
| # downloads its own pinned Node.js at build time, so the default is dead weight in a | ||
| # builder image. The node/npm/npx shims remain and fetch the right version on | ||
| # first use. | ||
| # | ||
| # Keep this install line in sync with docker/Dockerfile.alpine. | ||
| RUN curl -fsSL https://vite.plus | VP_VERSION="${VP_VERSION}" VP_PR_VERSION="${VP_PR_VERSION}" bash \ | ||
| && vp --version \ | ||
| && rm -rf "$VP_HOME/js_runtime" | ||
|
|
||
| WORKDIR /app | ||
|
fengmk2 marked this conversation as resolved.
fengmk2 marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # Alpine (musl) variant of the official Vite+ toolchain image. | ||
| # | ||
| # Smaller base than the Debian image, but note the tradeoffs: | ||
| # - Vite+ installs Node.js from the unofficial musl builds | ||
| # (unofficial-builds.nodejs.org), which are NOT PGP-signed. | ||
| # - Some native addons need musl prebuilds or source compilation. | ||
| # - A musl Node.js binary only runs on a musl base, so pair this builder with | ||
| # an Alpine runtime stage (see docs/guide/docker.md). | ||
| # | ||
| # Prefer the Debian image (ghcr.io/voidzero-dev/vite-plus) unless you | ||
| # specifically need Alpine/musl. | ||
|
|
||
| FROM alpine:3.21 | ||
|
|
||
| LABEL org.opencontainers.image.source="https://github.com/voidzero-dev/vite-plus" \ | ||
| org.opencontainers.image.description="Vite+ toolchain image (vp CLI, Alpine/musl) for build, CI, and development" \ | ||
| org.opencontainers.image.licenses="MIT" | ||
|
|
||
| # Version of vp to install. Override at build time: | ||
| # docker build --build-arg VP_VERSION=1.4.2 -f docker/Dockerfile.alpine . | ||
| ARG VP_VERSION=latest | ||
|
|
||
| # Optional: build a preview image from a pkg.pr.new build instead of npm. | ||
| ARG VP_PR_VERSION= | ||
|
|
||
| # build-base + python3 let native addons compile from source on musl; | ||
| # openssh-client supports git+ssh dependencies. | ||
| RUN apk add --no-cache \ | ||
| bash \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| openssh-client \ | ||
| tar \ | ||
| build-base \ | ||
| python3 \ | ||
| && adduser -D -s /bin/bash vp \ | ||
| # Own /app for the vp user so downstream `WORKDIR /app` + `vp install` can write. | ||
| && mkdir -p /app \ | ||
| && chown vp:vp /app | ||
|
|
||
| # Run as a non-root user by default (mirrors oven/bun's `bun` and Deno's `deno`). | ||
| USER vp | ||
|
|
||
| ENV VP_HOME=/home/vp/.vite-plus \ | ||
| PATH=/home/vp/.vite-plus/bin:$PATH | ||
|
|
||
| # Install the vp global CLI (musl build), then drop the pre-provisioned default | ||
| # Node.js: each project provisions its own pinned Node at build time, so the | ||
| # default is dead weight. The node/npm/npx shims remain and fetch the right | ||
| # version on first use. | ||
| # | ||
| # Keep this install line in sync with docker/Dockerfile. | ||
| RUN curl -fsSL https://vite.plus | VP_VERSION="${VP_VERSION}" VP_PR_VERSION="${VP_PR_VERSION}" bash \ | ||
| && vp --version \ | ||
| && rm -rf "$VP_HOME/js_runtime" | ||
|
|
||
| WORKDIR /app |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.