aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

DockerImageAsset: environmental variables

Open austinmw opened this issue 1 year ago • 5 comments

Describe the feature

Is it possible to include environmental variables in the docker build? I don't see it included here: https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ecr_assets/DockerImageAsset.html

Use Case

I would like to include the following env vars when building docker images with CDK:

DOCKER_BUILDKIT=1
CDK_DOCKER=finch

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

CDK version used

latest

Environment details (OS name and version, etc.)

MacOS

austinmw avatar Jan 12 '24 16:01 austinmw

Is it possible to do this with docker build?

michaelwiles avatar Jan 13 '24 13:01 michaelwiles

As is, I would need to add to the app instructions to export these env vars before calling CDK deploy.

austinmw avatar Jan 13 '24 14:01 austinmw

Does it help to export that before the cdk deploy like?

export DOCKER_BUILDKIT=1
npx cdk synth

pahud avatar Jan 16 '24 13:01 pahud

@pahud Sure it works to explicitly export env vars, but I was hoping they could be defined in the build process.

austinmw avatar Jan 16 '24 14:01 austinmw

any updates on this? Sounds like an important feature to have.

adminy avatar Aug 13 '24 19:08 adminy