I'd like to
- provide an option to not push if there isn't a rebuild
push_if_changed: true or similar ?
- know if the container had to rebuild, perhaps with an output
- If it doesn't, then I know that there must have been file changes in the branch commits ignored successfully by the
.dockerignore. If the container does not have to rebuild, then I do not have to redeploy the app.
We can detect if a previous build is the same as current build by comparing the Id which doesn't change if the docker build doesn't change.
docker inspect --format {{.Id}} $docker_image_name
Source: https://stackoverflow.com/a/45306984/2965993