The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

docker-build - Docker Build from a template file

USAGE

Using the same arguments as "docker build"

DATA POINTS

By default all the data points are from the environment variables.

If you need to pass in dynamic data points, there are some examples as below:

Add a function to the template to get a list of files

In the Dockerfile template

 [% FOREACH file IN list %]
 ADD [% file %] /home/here/[% file %]
 [% END %]

From the command line

 docker-build =Slist 'split /\n/, qx{find . -type f}' --tag some/image .

Load a File::Slurp to list the directory

In the Dockerfile template

 [% FOREACH file IN list %]
 ADD [% file %] /home/here/[% file %]
 [% END %]

From the command line

 docker-build =MFile::Slurp =Slist 'read_dir(".")' --tag some/image .

Add an extra key value

In the Dockerfile template

 FROM base/image

 AUTHOR [% author %]

 ...

From the command line

 docker-build =KVauthor "$USER <$EMAIL>" --tag some/image .