Reputation: 3746
I have two applications (.net core 3.1 and Angular 8) which are deployed on aws ecs as a docker containers. Now I want to setup multiple environments e.g quality, staging, production etc. Now I want read data from specific configuration file so that for staging docker container will read data from appsettings.staging.json and for production, it will read data from appsettings.production.json. Same for Angular.
How can I do that? I can specify environment variables in codebuild in aws but how can I tell docker to read specific files?
Upvotes: 0
Views: 2617
Reputation: 8890
Some random thoughts:
Ref:
[1] https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
[2] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data-tutorial.html
Upvotes: 1
Reputation: 22553
There are a number of ways to skin this cat. They all involve creating a separate task definition for each environment (all using the same container).
You can pass different environment variables into each task definition (or mount different volumes).
You could package all the config files in your container, and have an environment variable that points at the proper file for each environment.
There are other options that wouldn't require packaging all the configs in the docker file. This has advantages since you don't need to rebuild the container when you change the config.
You could put all the configs in environment variables, use the AWS secrets manager, or mount a different volume with the config for each task definition.
Upvotes: 0