Uhm, any idea why I cannot add a comment to your answer @David Maze? My follow-up question would be that I intended to do exactly as syou described, but for your steps:
Build the image from the Dockerfile
Run integration tests against that image
You would need docker-in-docker, right ? I guess that what you described is exactly what's specified here:
You can specify an additional image by using the
serviceskeyword. This additional image is used to create another container, which is available to the first container. The two containers have access to one another and can communicate when running the job.
My only issue is: The generation of the image (the first of my steps quoted from you above) is somewhat complex, and I don't necessarily want to replicate the entire build flow of my Dockerfile within my CI pipeline ? So if the build is very long (around 500 lines in my dockerfile), how would you replicate that into a CI build job ?