NAME
App::Dockerfile::Template - Make Dockerfile as Template Toolkit template file and use environment variables as data points
INSTALLATION
Install with cpan
cpan -i App::Dockerfile::Template
Install with cpanm
cpanm App::Dockerfile::Template
Install with carton
echo 'requires "App::Dockerfile::Template";' >> cpanfile
carton install
USAGE
Dockerfile example
Create a Dockerfile with varialbles
FROM [% OS_NAME || "ubuntu" %]:[% OS_VERSION || "latest" %]
ENV PLACK_ENV [% PLACK_ENV || "development" %]
ENV DB_HOST [% DB_HOST %]
ENV DB_USER [% DB_USER %]
ENV DB_PASS [% DB_PASS %]
ENV DB_NAME [% DB_NAME %]
BUILD
export PLACK_ENV=prod
export DB_HOST=foo.com
export DB_USER=bar
export DB_PASS=s0m3th1ng
export DB_NAME=runtime
Same arguments with docker build command
docker-build -t foo/bar .
What is behind the sense
1. Use Environment Variables with Template Toolkit to output a buildable Dockerfile
2. Run docker build the new Dockerfile with the command arguments