Manage environments with an Angular app in Nginx
You can create just one package with the configurationin json files, retrieved at run time, like shown here
If you have multiple config.[envName].json
files (1 per environment), then, when you run your image, you need to copy the one for the corresponding environment to config.json
which will be the one requested by angular)
To achieve that, you could run a bash script that copies the file (identified thanks to an environment variable) then start nginx when you run your image, instead of starting nginx directly
run.sh
#!/bin/shcp /config/folder/path/config.$ENVNAME.json /config/folder/path/config.json#start nginx
and run that file as your docker command
Other option
If you have the lua module installed, you could write some dynamic script that'd serve the correct json config file based on some environment varible (that lua can access)