{"modulePath":"github.com/coder/envbuilder","version":"v1.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package devcontainer\n\n## Functions\n\n```go\nfunc BuildArgsMap(buildArgs []string) map[string]string\n```\nBuildArgsMap converts a slice of \"KEY=VALUE\" strings to a map.\n\n```go\nfunc ImageFromDockerfile(dockerfileContent string, buildArgs map[string]string) (name.Reference, error)\n```\nImageFromDockerfile inspects the contents of a provided Dockerfile and returns the image that will be used to run the container.\n\n```go\nfunc SubstituteVars(s string, workspaceFolder string, lookupEnv func(string) (string, bool)) string\n```\n\n```go\nfunc UserFromDockerfile(dockerfileContent string, buildArgs map[string]string) (user string, err error)\n```\nUserFromDockerfile inspects the contents of a provided Dockerfile and returns the user that will be used to run the container.\n\n```go\nfunc UserFromImage(ref name.Reference) (string, error)\n```\nUserFromImage inspects the remote reference and returns the user that will be used to run the container.\n\n## Types\n\n```go\ntype BuildSpec struct {\n\tDockerfile string            `json:\"dockerfile\"`\n\tContext    string            `json:\"context\"`\n\tArgs       map[string]string `json:\"args\"`\n\tTarget     string            `json:\"target\"`\n\tCacheFrom  string            `json:\"cache_from\"`\n}\n```\n\n```go\ntype Compiled struct {\n\tDockerfilePath    string\n\tDockerfileContent string\n\tBuildContext      string\n\tFeatureContexts   map[string]string\n\tBuildArgs         []string\n\n\tUser         string\n\tContainerEnv map[string]string\n\tRemoteEnv    map[string]string\n}\n```\nCompiled is the result of compiling a devcontainer.json file.\n\n```go\ntype LifecycleScript struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (s *LifecycleScript) Execute(ctx context.Context, uid, gid int) error\n```\n\n```go\nfunc (s *LifecycleScript) IsEmpty() bool\n```\n\n```go\nfunc (s *LifecycleScript) ScriptLines() string\n```\nScriptLines returns shell syntax for executing the commands in the LifecycleScript.\n\nTODO: Technically the commands could be executed in parallel, but that would add a bit of complexity to do portably.\n\n```go\nfunc (s *LifecycleScript) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype LifecycleScripts struct {\n\tOnCreateCommand      LifecycleScript `json:\"onCreateCommand\"`\n\tUpdateContentCommand LifecycleScript `json:\"updateContentCommand\"`\n\tPostCreateCommand    LifecycleScript `json:\"postCreateCommand\"`\n\tPostStartCommand     LifecycleScript `json:\"postStartCommand\"`\n}\n```\n\n```go\ntype Spec struct {\n\tImage         string            `json:\"image\"`\n\tBuild         BuildSpec         `json:\"build\"`\n\tRemoteUser    string            `json:\"remoteUser\"`\n\tContainerUser string            `json:\"containerUser\"`\n\tContainerEnv  map[string]string `json:\"containerEnv\"`\n\tRemoteEnv     map[string]string `json:\"remoteEnv\"`\n\t// Features is a map of feature names to feature configurations.\n\tFeatures map[string]any `json:\"features\"`\n\tLifecycleScripts\n\n\t// Deprecated but still frequently used...\n\tDockerfile string `json:\"dockerFile\"`\n\tContext    string `json:\"context\"`\n}\n```\n\n```go\nfunc Parse(content []byte) (*Spec, error)\n```\nParse parses a devcontainer.json file.\n\n```go\nfunc (s *Spec) Compile(fs billy.Filesystem, devcontainerDir, scratchDir string, fallbackDockerfile, workspaceFolder string, useBuildContexts bool, lookupEnv func(string) (string, bool)) (*Compiled, error)\n```\nCompile 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.\n\n```go\nfunc (s Spec) HasDockerfile() bool\n```\nHasDockerfile returns true if the devcontainer.json specifies the path to a Dockerfile.\n\n```go\nfunc (s Spec) HasImage() bool\n```\nHasImage returns true if the devcontainer.json specifies an image.\n\n","path":"github.com/coder/envbuilder/devcontainer","name":"devcontainer","synopsis":"","isRedistributable":true}
