A simple script to avoid redundant builds of docker images.
Sometimes the docker cache just isn't enough:
- The entire build context, which may include large assets, is uploaded to the docker daemon even if all layers are cache hits.
- Non-standard build process where containers build other containers, such as gockerize, cannot easily take advantage of the docker cache.
In these cases, simply comparing the creation timestamp of the image to that of the most recently modified file in the build context is sufficient to safely avoid redundant builds.
BSD 2-Clause, see accompanying LICENSE file.
- docker 1.5+
source img_fresh.sh if img_fresh myimage path/to/build/context ; then echo myimage up-to-date else docker build -t myimage path/to/build/context fi