Configuring build-time variables
Assume your front-end app needs theREACT_APP_API_URL
so it knows the back-end address to send requests to.
In that case, your Dockerfile
must take an ARG
and assign the value of that arg to the REACT_APP_API_URL
environment variable, as shown below
dev.ergomake.env.replace-arg.REACT_APP_API_URL
. Within that label, we can interpolate the URL of each service using services.<SERVICE_NAME>.url
, as shown below.
Build-time variables are built into the resulting image. Therefore, you
should avoid using secrets as build-time variables.
Configuring runtime variables
You should set third-party API keys and other sensitive information as runtime variables. These secrets and environment variables usually come in the form of a.env
file.
If you have an
.env
file, please do not use it in your
docker-compose.yml
file, unless you commit that file to your repository
— which you probably shouldn’t do.

All runtime variables are encrypted at rest.
Branch-specific environment variables
You set environment variables for a specific branch by typing a branch name into the environment variables form. When the branch name field is left empty, the environment variable will apply to all branches. When filled, the environment variable will only apply to that particular branch. Branch-specific environment variables take precedence over environment variables set for all branches. For example, if you setMY_VAR
as foo
for all branches and MY_VAR
as bar
for branch staging
, the value of MY_VAR
in staging
environments will be bar
.