I'm trying to figure out the proper way to get build environments into a CI pipeline.
What I want to achieve is:
- someone pushes to the docker source repo (not registry, a repo with the docker folder)
- jenkins kicks off a build of that docker image
- if successful docker then goes and runs a software build using the newly built docker image
- if successful the docker image is tagged and pushed to the docker registry
All I have so far is a Jenkins file that has four stages
- checks out out docker source repo
- builds docker image from source
- Checks out software source code (code that builds in the docker environment)
- builds software source code in docker container
- If successful tags and pushes new image to docker registery
My main concern is everything I'm doing is going to be in the 'script' blocks, except the git checkouts, and it feels super hacky to be building and kicking off docker builds with jenkins using bash...
are there any tools/already defined procedures to do things like this? Is this the best way to do it? I am looking for a best practice approach as this will be put into production and I want it to be as resilient and long lasting as possible.