1
0

feat: command for the update of containers

This commit is contained in:
dump_stack() 2024-10-06 15:49:19 +00:00
parent 3f0c28014c
commit cba1abc7f4
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB

View File

@ -19,6 +19,7 @@ type ContainerCmd struct {
Filter string `help:"filter by name"`
List ContainerListCmd `cmd:"" help:"list containers"`
Update ContainerUpdateCmd `cmd:"" help:"update containers"`
Save ContainerSaveCmd `cmd:"" help:"save containers"`
Cleanup ContainerCleanupCmd `cmd:"" help:"cleanup containers"`
}
@ -47,6 +48,39 @@ func (cmd ContainerListCmd) Run(containerCmd *ContainerCmd) (err error) {
return
}
type ContainerUpdateCmd struct{}
func (cmd ContainerUpdateCmd) Run(g *Globals, containerCmd *ContainerCmd) (err error) {
images, err := container.Images()
if err != nil {
return
}
container.UseCache = false
container.UsePrebuilt = false
// TODO move from all commands to main command line handler
container.Commands = g.Config.Docker.Commands
container.Registry = g.Config.Docker.Registry
container.Timeout = g.Config.Docker.Timeout.Duration
for _, img := range images {
if containerCmd.Filter != "" {
if !strings.Contains(img.Name, containerCmd.Filter) {
log.Debug().Msgf("skip %s", img.Name)
continue
}
}
_, err = img.Distro.Packages()
if err != nil {
return
}
}
return
}
type ContainerSaveCmd struct {
OutDir string `help:"directory to save containers" default:"./" type:"existingdir"`
}