From aba95b8074309613486e0d6db943efdd5a079be2 Mon Sep 17 00:00:00 2001 From: Hamster Date: Sat, 1 Sep 2018 00:10:53 +1000 Subject: [PATCH] Add README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..dea7e28 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# GoEnValue - a simple templates processor from environment variables. + +This tool very useful if you need to configure your containerised software. +You can do it by passing environment variables into container on your Docker container start. + +How it works +--- +You need to: + 1. create templates from your configuration files + 2. add in your entrypoint script state with execution of goenvalue + 3. build image with your software, templates and goenvalue + 4. run container with environment variables + +Example +--- +**php.ini.tpl** +```ini + ... + memory_limit = {{ .MEMORY_LIMIT }} + ... +``` + +**Dockerfile** +```Dockerfile + FROM php:7 + ENV PHP_MEMORY_LIMIT="64M" + COPY php.ini.tpl /etc/php/php.ini.tpl + COPY entrypoint.sh /entrypoint.sh + ... + ENTRYPOINT /entrypoint.sh +``` + +**entrypoint.sh** +```bash + #!/bin/bash + goenvalue -p PHP -i /etc/php/php.ini.tpl + exec $@ +``` + +Test it: +```bash + $ docker run --rm -it -e PHP_MEMORY_LIMIT=128M my/php:7 php -i | grep memory_limit + memory_limit => 128M => 128M +```