How to manage environment variables for build and runtime.
REACT_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.
.env
file.
.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.MY_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
.