Creating Docker Images#
Why create docker images?#
At CPG, we maintain a set of prebuilt Docker images. If you can’t find the image you need, you have the flexibility to create a custom one. Consider creating a new image when developing pipelines or working with third-party software that requires a specific environment. Docker images help you standardize, isolate, and control dependencies, ensuring consistency across development and production environments.
Getting started#
To view the images available for use in CPG you can browse them in GCP Artifact Registry.
How to create an image#
Create a Branch
In your local checkout of the images repository, create a new branch for your image development work.
Set Up the New Image Directory
Create a new folder named after the tool or software you are packaging.
Write the Dockerfile
Inside the newly created folder, create a Dockerfile and define the necessary instructions to build your image.
Commit and Push Your Changes
Once your Dockerfile is ready, commit the changes and create a pull request (PR) in the repository.
Continuous Integration (CI) and Image Deployment
When CI completes, the new image is automatically built and pushed to the images-dev folder of Artifact Registry.
Test Your Image
Depending on your use case, thoroughly test your newly built image to ensure it functions as expected.
Merge and Deploy
Once testing is complete and the image is approved, merge the PR. This triggers an automatic deployment to the production version of the Artifact Registry.
By following this process, you ensure a structured, repeatable, and efficient way to manage Docker images within CPG.