1 Answer
- Newest
- Most votes
- Most comments
-1
Since a Docker container is used to build Lambda, it is necessary to set "dockerEnabledForSynth: true" to enable privileged mode during build.
https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_pipelines.CodePipeline.html
So I thought this is how it would look as a code.
Note that "dockerEnabledForSelfMutation: true" must also be added if Docker image Assets are used on CDK Pipelines.
new CodePipeline(this, 'Pipeline', {
pipelineName: 'TestPipeline',
synth: new ShellStep('Synth', {
input: CodePipelineSource.gitHub('ivozmediano/microservicios', 'main'),
commands: [
'npm ci',
'npm run build',
'npx cdk synth',
]
}),
dockerEnabledForSynth: true
});
}
}
Relevant content
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years ago
Hi Riku, I tried your solution but it's still not working, same error. Thanks a lot anyway!
By the way, if I clone CodePipelineSource.gitHub('ivozmediano/microservicios', 'main') locally and run "npm ci", "npm run build", "npx cdk synth" locally, I get error?
Probably, because of credentials
Are there any errors in the npm run build execution log when you run the CDK? You may also want to check if you have successfully cloned from GitHub.
There are no errors in npm run build locally. I tried a different node version and, locally, I can run npx cdk synth, but when I try to deploy code using CodePipeline, error again.