How to build multiple images from a single codebase
When your needs grow beyond just one user on one machine, you might want to build multiple versions of your custom image for different use cases or based on different base images. This guide outlines the configuration steps required to build multiple images out of a single repository.
-
Create a new recipe file.
- To make this easier, you might want to just duplicate and rename your other recipe file.
- Make sure to name your recipe files accordingly, for example:
recipe-gnome.yml
for a GNOME version of your image andrecipe-kde.yml
for a KDE version of your image.
-
Edit your new recipe file. You should at least change the name of the image to prevent collision with your other images, but other changes can also made at this point.
-
Example:
-
-
Open the build workflow file in
.github/workflows/build.yml
and edit the list of recipe files underjobs: bluebuild: strategy: matrix: recipe:
to contain all the recipes you want to build.-
The list simply consists of paths under the
recipes/
folder in your git repository. For example, if you have many recipes and want to store them all in a subdirectory likerecipes/common/
, you can use them inbuild.yml
by specifying the subdirectory. -
After this step, all versions of your custom images should start building.
-
Example:
-
If you want to share parts of configuration between your different image, check out “How to split configuration into multiple files”.