Documentation
¶
Index ¶
- func BaseImageTag() string
- func BuildArgv(spec RunSpec, fs FS, lookPath func(string) (string, error)) []string
- func BuildImage(ctx context.Context, configDir string, noCache bool, verbose bool, ...) error
- func DockerfileChanged(configDir string) bool
- func EnsureNetwork(ctx context.Context) error
- func ImageExists(ctx context.Context, tag string) bool
- func LocalImageID(ctx context.Context) (string, error)
- func RemoveOrphanedContainer(ctx context.Context, name string) error
- func UserImageTag() string
- type FS
- type FSFunc
- type RunSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseImageTag ¶
func BaseImageTag() string
BaseImageTag returns the base image tag used in scaffold FROM, allowing override via DEVCELL_BASE_IMAGE env var (local dev, CI, tests).
func BuildArgv ¶
BuildArgv constructs the full docker run argv for the given spec. It is pure given injectable FS and LookPath.
func BuildImage ¶
func BuildImage(ctx context.Context, configDir string, noCache bool, verbose bool, out io.Writer) error
BuildImage runs docker build to build UserImageTag from configDir. verbose=true streams plain-text output to out; verbose=false suppresses all docker output (quiet mode) and captures stderr to out for error replay. --pull is always passed so Docker checks for a newer base image digest and busts the layer cache when the upstream image has been updated.
func DockerfileChanged ¶
DockerfileChanged reports whether any build-input file in configDir (Dockerfile, flake.nix) is newer than the user image. Returns true when the user image doesn't exist or inspect fails.
func EnsureNetwork ¶
EnsureNetwork creates the devcell-network docker network if it doesn't exist.
func ImageExists ¶
ImageExists returns true if a Docker image with the given tag exists locally.
func LocalImageID ¶
LocalImageID returns the full image ID (sha256:...) of the user image. Used to pin the running container to the exact image just built, rather than the mutable tag which could race with a concurrent build.
func RemoveOrphanedContainer ¶
RemoveOrphanedContainer removes a stopped container with the given name if it exists. Returns nil if the container doesn't exist or was successfully removed. Returns an error if the container is currently running.
func UserImageTag ¶
func UserImageTag() string
UserImageTag returns the user image tag, allowing override via DEVCELL_USER_IMAGE env var (used by tests to avoid clobbering real images).
Types ¶
type RunSpec ¶
type RunSpec struct {
Config config.Config
CellCfg cfg.CellConfig
Binary string
DefaultFlags []string
UserArgs []string
Debug bool // pass DEVCELL_DEBUG=true into the container
Image string // image ID or tag to run; defaults to UserImageTag
ExtraEnv map[string]string // additional env vars injected by the command handler
}
RunSpec holds everything needed to build the docker run argv.