1
0

fix: support updating containers

This commit is contained in:
dump_stack() 2023-05-24 16:43:25 +00:00
parent ee90bfaa72
commit abcf2c1013
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 14 additions and 1 deletions

View File

@ -33,6 +33,10 @@ var Timeout = time.Hour
var Commands []config.DockerCommand
// Not thread-safe, but for our case there is no cmdline parameters
// to update separate containers anyway
var Update = false
type Image struct {
Name string
Distro distro.Distro
@ -152,6 +156,10 @@ func (c Container) Name() string {
}
func (c Container) Exist() (yes bool) {
if Update {
return false
}
cmd := exec.Command(Runtime, "images", "-q", c.name)
c.Log.Debug().Msgf("run %v", cmd)
@ -231,6 +239,9 @@ func (c Container) Build(image string, envs, runs []string) (err error) {
func (c Container) build(imagePath string) (output string, err error) {
args := []string{"build"}
if Update {
args = append(args, "--pull", "--no-cache")
}
args = append(args, "-t", c.name, imagePath)
cmd := exec.Command(Runtime, args...)

View File

@ -128,7 +128,9 @@ func (cmd *KernelCmd) GenKernel(km config.Target, pkg string, max *int) {
}
func (cmd *KernelCmd) Generate(g *Globals, km config.Target, max int) (err error) {
// TODO cmd.Update
if cmd.Update {
container.Update = true
}
cmd.kcfg, err = config.ReadKernelConfig(g.Config.Kernels)
if err != nil {