Now that we support an increasing number of Docker build flags in the manifest, customers want to be able to customize these flags per environment the same way they customize environment variables, secrets, and CPU values for different environments.
The image.build section of the manifest is slightly different than the rest of the fields because it's the only field which doesn't correlate directly to some aspect of the underlying cloudformation and is instead handled by docker build. We should add functionality to build a service or job's image for a particular environment, employing a merge strategy the same way we handle the rest of the env overrides.
I think I've been running into an issue recently where I'm trying to override the build image arguments on a per-environment basis at the bottom of the manifest file with something like:
# You can override any of the values defined above by environment.
environments:
dev:
image:
build:
args:
API_URL: <value>
AWS_CLIENT_ID: <value>
AWS_POOL_ID: <value>
AWS_REGION: <value>
AWS_USER_POOL_ID: <value>
HERE_APP_ID: <value>
SALESFORCE_URL: <value>
SALESFORCE_USER: <value>
It hasn't been working as expected and it sounds like the topic of this issue could be the case. If build arguments are not overridable by environment already, we would definitely like to see support for this improvement soon -- at least correct the comment in the manifest.yml that "# You can override any of the values defined above by environment." to not suggest they can be.
If you can override them currently, any suggestions on what is wrong with my config?
OMG sorry for the late reply on this--you're correct that you can't currently override build args by environment. We've had this bite enough people lately that we should consider taking it on very soon.
A workaround for the time being is to build your image manually and push it to the ECR repository created by Copilot, then you can specify the newly pushed image in the image.location field of the manifest instead of using image.build.
related: #2382
This is now out in v1.8.0 馃コ https://github.com/aws/copilot-cli/releases/tag/v1.8.0