containerfile
The containerfile
module is a tool for adding custom Containerfile
instructions for custom image builds. This is useful when you wish to use some feature directly available in a Containerfile
, but not in a bash module, such as using a RUN
instruction with custom mounts.
Since standard compiler-based BlueBuild image builds generate a Containerfile
from your recipe, there is no need to manage it yourself. However, we know that we also have technical users that would like to have the ability to customize their Containerfile
. This is where the containerfile
module comes into play.
Usage
snippets:
The snippets
property is the easiest to use when you just need to insert a few custom lines to the Containerfile
. Each entry under the snippets
property will be directly inserted into your final Containerfile
for your build.
This makes it really easy to add individual, custom instructions.
containerfiles:
The containerfiles
property allows you to tell the compiler which directory contains a Containerfile
in ./containerfiles/
.
Below is an example of how a containerfile
module would be used with the containerfiles
property:
In the example above, the compiler would look for these files:
./containerfiles/example/Containerfile
./containerfiles/subroutine/Containerfile
You could then store files related to say the subroutine
Containerfile
in ./containerfiles/subroutine/
to keep it organized and portable for other recipes to use.
Order of operations
The order of operations is important in a Containerfile
. There’s a very simple set of rules for the order in this module:
- For each defined
containerfile
module:- First all
containerfiles:
are added to the mainContainerfile
in the order they are defined - Then all
snippets
are added to the mainContainerfile
in the order they are defined
- First all
If you wanted to have some snippets
run before any containerfiles
have, you will want to put them in their own module definition before the entry for containerfiles
. For example:
In the example above, the COPY
from the snippets
will always come before the containerfiles
“example” and “subroutine”.
Example configuration
Configuration options
snippets:
(optional array)
Lines to directly insert into the generated Containerfile.
containerfiles:
(optional array)
Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile.