Skip to content

huguesb/img_fresh

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

img_fresh

A simple script to avoid redundant builds of docker images.

Why ?

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.

License

BSD 2-Clause, see accompanying LICENSE file.

Requirements

  • bash
  • docker 1.5+

Usage

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

About

Avoid redundant container builds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages