For generating configs for my Docker services using gomplate
Ian Fijolek
03406f4105
All checks were successful
continuous-integration/drone/push Build is passing
|
||
---|---|---|
tests | ||
.drone.yml | ||
.pre-commit-config.yaml | ||
Dockerfile | ||
LICENSE.txt | ||
Makefile | ||
manifest.tmpl | ||
Readme.md | ||
run.sh |
Gonfigurator
Runs gomplate
to generate config files from a template folder in a way that allows them to be edited.
On start, this container will look at all files in your /templates
directory and template them and write them to the /config
directory. Because some containers may need to modify these files and you may not want those changes blown away, this container will check it see if the template file is newer than the file residing in the /config
path. If it is not, then the file will be skipped.
Usage
version: '3.8'
services:
main:
image: ...
volumes:
- config:/config
config:
image: iamthefij/gonfigurator
volumes:
- config:/config
- ./templates
volumes:
config:
You may override the /templates
dir and the output /config
with $INPUT_DIR
and $OUTPUT_DIR
, respectively.
Alternatives
Docker Config / Secrets
Files are read only and cannot be edited by application
Using gomplate only
All files will be overrwriten whenver the container starts
Eg.
config:
image: hairyhenderson/gomplate
command: [
"--datasource", "secrets=/data/secrets.yml",
"--input-dir", "/templates",
"--output-dir", "/config"
]