Our CI process goes as this cycle (I think it is quite normal), unit test => build docker image => run function test against the image => if test fails remove the failed docker image, figure out the reason and build a new docker image.
But checking the test result and removing the failed images has become a labor-intensive job so I have been thinking how to improve our CI process. I now design a process that if the container fails the smoke test (or even worst, fails to start), I will make docker build
fails, so no more failed docker image.
But I face some technical difficulties, e.g. for my node.js project, if I just add RUN npm run start
in Dockerfile, not as the entrypoint but in order to test it, and if it fails to run, docker build
indeed fails. But if npm run start
succeeds, docker build
won't exit then. I have to design some kludge/clever way to bypass this.
I do some research about my "improved" CI process but I can't find others do that. So is there problem with that ? My goal is to reduce failed docker images. If this process does have problem(s) what other options can I reduce failed docker images?
We have dedicated docker build servers, so the docker build time is not a concern here and as why removing the failed images has become a labor-intensive job it may deserve another question.
PS. I searched the similar questions here I can only find these 3, they are not my question.