devcontainer

package
v0.31.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: GPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package devcontainer parses the subset of a target repository's devcontainer.json the orchestrator honors when defaulting builds and runs into the repo's dev container: the image, its named cache volumes, and the remote user's home (so toolchain caches resolve where the dev container put them). Like preview.toml, the file is read from the committed tree of the deployed sha, never from a checkout.

Everything else — Dockerfile builds, features, runArgs, containerEnv, lifecycle commands — is deliberately ignored: honoring them faithfully requires the devcontainer CLI, and the goal here is only a warm, matching toolchain for build steps and server processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Image is the container image builds and runs default into.
	Image string `json:"image"`
	// Mounts are the devcontainer's named-volume mounts (bind mounts are
	// dropped — they reference paths personal to the developer's machine).
	// Sharing these volumes is what keeps preview builds warm: the dev
	// sandbox already populated them.
	Mounts []Mount `json:"mounts,omitempty"`
	// Home is the remote user's home directory, derived from remoteUser /
	// containerUser. Steps run with HOME set to it so toolchains (go, npm)
	// resolve their caches onto the mounted volumes.
	Home string `json:"home,omitempty"`
}

Config is the resolved subset of devcontainer.json. The zero value (empty Image) means "no usable devcontainer". It round-trips through JSON as part of stored run configs, so field order and tags are part of the contract.

func Parse

func Parse(data []byte) (Config, error)

Parse resolves devcontainer.json content against the server's environment (${localEnv:VAR} expansion). An unparseable file is an error; a parseable file without a usable image (e.g. a Dockerfile build) yields a zero Config and no error — the caller falls back to the host and says why.

type Mount

type Mount struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

Mount is one named-volume mount.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL