For generating configs for my Docker services using gomplate
Go to file
Ian Fijolek 03406f4105
All checks were successful
continuous-integration/drone/push Build is passing
Initial commit
2021-05-14 15:31:31 -07:00
tests Initial commit 2021-05-14 15:31:31 -07:00
.drone.yml Initial commit 2021-05-14 15:31:31 -07:00
.pre-commit-config.yaml Initial commit 2021-05-14 15:31:31 -07:00
Dockerfile Initial commit 2021-05-14 15:31:31 -07:00
LICENSE.txt Initial commit 2021-05-14 15:31:31 -07:00
Makefile Initial commit 2021-05-14 15:31:31 -07:00
manifest.tmpl Initial commit 2021-05-14 15:31:31 -07:00
Readme.md Initial commit 2021-05-14 15:31:31 -07:00
run.sh Initial commit 2021-05-14 15:31:31 -07:00

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"
    ]