If any of the files in test/$os_type is newer than the creation date of
a docker image, the image is removed and rebuilt from scratch. For
instance, when a package is added to debian/control, the debian based
images are rebuilt.
Signed-off-by: Loic Dachary <ldachary@redhat.com>
local opts="$3"
local image=$(get_image_name $os_type $os_version)
- if ! docker images $image | grep --quiet "^$image " ; then
+ local build=true
+ if docker images $image | grep --quiet "^$image " ; then
+ eval touch --date=$(docker inspect $image | jq '.[0].Created') $image
+ found=$(find -L test/$os_type/* -newer $image)
+ rm $image
+ if test -n "$found" ; then
+ docker rmi $image
+ else
+ build=false
+ fi
+ fi
+ if $build ; then
#
# In the dockerfile,
# replace environment variables %%FOO%% with their content