On Sun, Feb 07, 2021 at 07:53:14PM +0800, Liu Yinsi wrote:
when execute `sparrow/4-docker/buildall run-only`, if caller script
The run-only means run only without build. Why need export DOCKER_SKIP_REBUILD?
Thanks, Xueliang
export env DOCKER_SKIP_REBUILD, then image already is exist, just exit build script, not rebuild container.
Signed-off-by: Liu Yinsi liuyinsi@163.com
container/defconfig.rb | 6 ++++++ container/defconfig.sh | 8 ++++++++ 2 files changed, 14 insertions(+)
diff --git a/container/defconfig.rb b/container/defconfig.rb index f9b0824..820147a 100755 --- a/container/defconfig.rb +++ b/container/defconfig.rb @@ -47,3 +47,9 @@ def get_available_memory # take the middle value according to the system memory size. [1024, 30720, Math.sqrt(memtotal) * 1024].sort[1].to_i end
+def docker_skip_rebuild(tag)
- return unless ENV.include? 'DOCKER_SKIP_REBUILD'
- exit 1 if system "docker image inspect #{tag} > /dev/null 2>&1"
+end diff --git a/container/defconfig.sh b/container/defconfig.sh index 54e65b5..6f14890 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -41,3 +41,11 @@ push_image() docker tag "$src_tag" "$dst_tag" docker push "$dst_tag" }
+docker_skip_rebuild() +{
- tag=$1
- [ -z $DOCKER_SKIP_REBUILD ] && return
- docker image inspect $tag > /dev/null 2>&1
- [ "$?" == "0" ] && exit 1
+}
2.23.0