Load env vars with docker-compose env_file, secrets

You can get it to resolve at runtime by calling it in your code (as opposed to having it in config files, or module attributes, both of which resolve at build time). Some dependencies support taking config options at runtime, like Ecto. If, however, you want to configure eg dependencies using config/config.exs et al at runtime, Distillery supports it either through Config Providers or by setting REPLACE_OS_VARS=true and then defining your config like

config :hello, Hello.Repo,
  username: "${DATABASE_USER}",
  password: "${DATABASE_PASS}",
  hostname: "${DATABASE_HOST}",
  database: "${DATABASE_NAME}",
  port: "${DATABASE_PORT}",
  pool_size: 15

replace with your own options and env variables.

There’s more information in the DIstillery guide for working with Docker Deploying With Docker - Distillery Documentation