From bff4422098ed25dc477882713f856f92773e8727 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 24 May 2023 09:08:31 +0000 Subject: [PATCH] feat: update existing container in case of containerfile changes --- container/container.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/container/container.go b/container/container.go index 792e080..42f718e 100644 --- a/container/container.go +++ b/container/container.go @@ -208,7 +208,16 @@ func (c Container) Build(image string, envs, runs []string) (err error) { return } - c.Log.Debug().Msg("generate") + if c.Exist() { + c.Log.Info().Msg("update") + err = os.WriteFile(cfile, []byte(cf), os.ModePerm) + if err != nil { + return + } + + } else { + c.Log.Info().Msg("build") + } output, err := c.build(cdir) if err != nil { @@ -216,7 +225,7 @@ func (c Container) Build(image string, envs, runs []string) (err error) { return } - c.Log.Debug().Msg("success") + c.Log.Info().Msg("success") return }