feat: support read-only volume annotations
All checks were successful
/ build (push) Successful in 53s

This commit is contained in:
Marc 2024-06-09 00:23:53 -04:00
parent c1094c7020
commit 2ce774a249
Signed by: marc
GPG key ID: 048E042F22B5DC79
2 changed files with 12 additions and 5 deletions

View file

@ -93,6 +93,8 @@ func CreateContainer(definition service_definition.ContainerDefinition, knownVol
for _, volume := range definition.Volumes {
var host string
var suffix string
container := volume.Container
if volume.Name != "" {
@ -104,7 +106,11 @@ func CreateContainer(definition service_definition.ContainerDefinition, knownVol
log.Fatal("Invalid volume source configuration")
}
arg := []string{"-v", host + ":" + container}
if volume.ReadOnly == true {
suffix = ":ro"
}
arg := []string{"-v", host + ":" + container + suffix}
args = append(args, arg...)
}

View file

@ -20,6 +20,7 @@ type VolumeConfiguration struct {
Name string `yaml:"name"`
Container string `yaml:"container"`
Host string `yaml:"host"`
ReadOnly bool `yaml:"readonly"`
}
type ContainerDefinition struct {