is there a way to compare existing docker image with latest source (Git) and build it only when there is any code change?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


is there a way to compare existing docker image with latest source (Git) and build it only when there is any code change?



I have a gradle task which creates a docker image using the product code in Git. When the task is run docker image is created and pushed to repository/hub. But I would like to have a check where I do it only when there is a code change compared with last/latest docker image.




1 Answer
1



One way of doing this would be to wrap your docker build in a shell script.
This script will build the image with a label whose value is the commit hash.
The script will also check the value of this label for the current image and will compare it with the current commit hash before building.


docker build






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

Future solutions