Open dennisguse opened 2 years ago
Shouldn't this be done in the Dockerfile itself?
FROM alpine
ADD . /app
WORKDIR /app
RUN prepare-environment.sh
RUN yarn build
CMD yarn run
No. Commands must be executed before docker build. During the docker build is too late.
I wanted this because my requirements prevent me from doing cdk synth because docker build depends on other deploy results of CDK. docker images: cannot use tokens in buildArgs - improve validation and errors · Issue #3981 · aws/aws-cdk
Describe the feature
I need to execute a shell command before executing
cdk-asset
(that triggersdocker build
) within the generatedCodeBuildAction
.Use Case
Preparing the environment for the
docker build
as it otherwise fails.Proposed Solution
Add a property to
DockerImageAssetProps
:These prepareCommands will then be added to the
CodeBuildStep
that executes thedocker build
:https://github.com/aws/aws-cdk/blob/244135b333007adc1188f0ad8690be4e7526353d/packages/%40aws-cdk/pipelines/lib/codepipeline/codepipeline.ts#L687
Other Information
Hacky workaround: preprocess generated Cloudformation template using shell scripts after
cdk synth
.Acknowledgements
CDK version used
v2
Environment details (OS name and version, etc.)
not relevant