Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/build/oci/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ func BuildImageFromLayer(layer v1.Layer, ic types.ImageConfiguration, created ti
cfg.Config.WorkingDir = ic.WorkDir
}

if ic.Volumes != nil {
cfg.Config.Volumes = make(map[string]struct{})
for _, v := range ic.Volumes {
cfg.Config.Volumes[v] = struct{}{}
}
}

// Set these environment variables if they are not already set.
if ic.Environment == nil {
ic.Environment = map[string]string{}
Expand Down
8 changes: 8 additions & 0 deletions pkg/build/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ type ImageConfiguration struct {
//
// Deprecated: Use WithExtraPackages.
Options map[string]BuildOption `yaml:"options,omitempty"`
// Optional: A list of volumes to configure
//
// This is _not_ the same as Paths, but refers to the OCI spec "volumes"
// field used by some container runtimes (docker) to create volumes at
// runtime. For most use cases, this is not needed, but consider using this
// when the image requires special volume configuration at runtime for
// supported container runtimes.
Volumes []string `yaml:"volumes,omitempty"`
}

// Architecture represents a CPU architecture for the container image.
Expand Down