Documentation
¶
Overview ¶
Package dockerfile generates a Dockerfile that wraps a devcontainer base image (or upstream Dockerfile) with feature install scripts and a pre-staged VS Code server.
The resulting Dockerfile is a single-stage build that:
- FROM the base image (or an intermediate stage produced by an upstream Dockerfile build).
- Writes devcontainer-features.builtin.env (_CONTAINER_USER, _REMOTE_USER and their homes) into /tmp/dev-container-features/.
- For each feature in install order: sets the feature's containerEnv, COPYs its contents into /tmp/dev-container-features/<safe-id>/ next to its devcontainer-features.env (option values) and install wrapper, and RUNs the wrapper, which exports both env files and runs install.sh (as upstream devcontainers/cli does).
- COPY the VS Code server tarball into the canonical ~/.vscode-server/bin/<commit>/ location and unpack it.
- Set ENV / USER according to the spec. Like upstream, the base image's WORKDIR is kept.
The generator does not run the build itself; it only emits the Dockerfile bytes plus a list of files that must be present in the build context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Inputs ¶
type Inputs struct {
// BaseMetadata is the metadata of the FROM image, before features and config.
BaseMetadata []metadata.Entry
Metadata metadata.CollectOptions
OmitSyntaxDirective bool
// Spec is the loaded devcontainer.json.
Spec *spec.DevContainer
// BaseImage is the FROM image. May be either the spec's `image`
// field, or a tag produced by a prior build of the
// spec's upstream Dockerfile.
BaseImage string
// Features in install order, all already staged on disk.
Features []features.Resolved
// FeaturesContextDir is the path within the build context that
// contains the staged feature directories. Each feature is at
// FeaturesContextDir/<SafeID>.
FeaturesContextDir string
// VSCodeServer optionally injects a VS Code server tarball.
VSCodeServer *vscode.Result
// VSCodeServerContextPath is the path within the build context to
// the server tarball (relative to context root).
VSCodeServerContextPath string
// RemoteUser overrides the spec's remoteUser. Empty means use the
// spec's value, falling back to root.
RemoteUser string
// ImageUser is the user configured in the base image, restored after
// installation. Features see it as the container user when the spec
// sets no containerUser.
// Empty means root.
ImageUser string
}
Inputs collects everything the generator needs.
Click to show internal directories.
Click to hide internal directories.