Documentation ¶
Index ¶
- func ImageFromDockerfile(dockerfileContent string) (name.Reference, error)
- func SubstituteVars(s string, workspaceFolder string, lookupEnv func(string) (string, bool)) string
- func UserFromDockerfile(dockerfileContent string) (user string, err error)
- func UserFromImage(ref name.Reference) (string, error)
- type BuildSpec
- type Compiled
- type LifecycleScript
- type LifecycleScripts
- type Spec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageFromDockerfile ¶
ImageFromDockerfile inspects the contents of a provided Dockerfile and returns the image that will be used to run the container.
func SubstituteVars ¶ added in v0.2.7
func UserFromDockerfile ¶
UserFromDockerfile inspects the contents of a provided Dockerfile and returns the user that will be used to run the container.
Types ¶
type Compiled ¶
type Compiled struct { DockerfilePath string DockerfileContent string BuildContext string FeatureContexts map[string]string BuildArgs []string User string ContainerEnv map[string]string RemoteEnv map[string]string }
Compiled is the result of compiling a devcontainer.json file.
type LifecycleScript ¶ added in v0.2.4
type LifecycleScript struct {
// contains filtered or unexported fields
}
func (*LifecycleScript) Execute ¶ added in v0.2.4
func (s *LifecycleScript) Execute(ctx context.Context, uid, gid int) error
func (*LifecycleScript) IsEmpty ¶ added in v0.2.4
func (s *LifecycleScript) IsEmpty() bool
func (*LifecycleScript) ScriptLines ¶ added in v0.2.4
func (s *LifecycleScript) ScriptLines() string
ScriptLines returns shell syntax for executing the commands in the LifecycleScript.
TODO: Technically the commands could be executed in parallel, but that would add a bit of complexity to do portably.
func (*LifecycleScript) UnmarshalJSON ¶ added in v0.2.4
func (s *LifecycleScript) UnmarshalJSON(data []byte) error
type LifecycleScripts ¶ added in v0.2.4
type LifecycleScripts struct { OnCreateCommand LifecycleScript `json:"onCreateCommand"` UpdateContentCommand LifecycleScript `json:"updateContentCommand"` PostCreateCommand LifecycleScript `json:"postCreateCommand"` PostStartCommand LifecycleScript `json:"postStartCommand"` }
type Spec ¶
type Spec struct { Image string `json:"image"` Build BuildSpec `json:"build"` RemoteUser string `json:"remoteUser"` ContainerUser string `json:"containerUser"` ContainerEnv map[string]string `json:"containerEnv"` RemoteEnv map[string]string `json:"remoteEnv"` // Features is a map of feature names to feature configurations. Features map[string]any `json:"features"` LifecycleScripts // Deprecated but still frequently used... Dockerfile string `json:"dockerFile"` Context string `json:"context"` }
func (*Spec) Compile ¶
func (s *Spec) Compile(fs billy.Filesystem, devcontainerDir, scratchDir string, fallbackDockerfile, workspaceFolder string, useBuildContexts bool, lookupEnv func(string) (string, bool)) (*Compiled, error)
Compile returns the build parameters for the workspace. devcontainerDir is the path to the directory where the devcontainer.json file is located. scratchDir is the path to the directory where the Dockerfile will be written to if one doesn't exist.
func (Spec) HasDockerfile ¶ added in v0.1.5
HasDockerfile returns true if the devcontainer.json specifies the path to a Dockerfile.