Maybe this is a little bit off-topic. I would like to ask how you manage your dockerfile.
I have a git repo hosting my configurations (docker-compose, traefik, etc). Then, I have a python script that reads data from JSON, renders the placeholder inside these files (the {{replace_me}}
) by an actual value and outputs them to another directory. Finally, I cd
to that directory and run docker-compose up -f ...
. (This approach takes inspiration from the terraform
templatefile
)
That JSON file is generated by some terraform code, along with terraform code for other stuffs (storage bucket, vps, dns, etc).
It works well for me so far. Especially for:
- templating
traefik toml
configuration (I like it a lot more than the label approach). - secret in the docker env file (so my docker.env file has the form of
secrect={{secret}}
.
I know most templating docker part can be replaced by directly interpolating with environment variables but I don’t really like it because it seems environment variables are not persistent.
Do you have any suggestions for my workflow ? I am always feel a litte bit off about this approach.
Honestly look into k3s or other “distros” of k8s. There are some versions of the orchestrator made for edge computing that are quite slim in their size and gives you all the perks of the k8s api layer.