可能是Dockerfile或Dockerrun.aws.json文件缺少或在错误的位置。确保这两个文件在您的应用程序根目录中。您需要在构建阶段将这两个文件提交到仓库中,以便它们可以包含在部署过程中。
需要在构建阶段添加以下代码:
...
phases:
build:
commands:
- echo Build started on `date`
- apt-get -y update && apt-get install -y awscli
- echo Logging in to Amazon ECR...
- $(aws ecr get-login --region $AWS_DEFAULT_REGION)
- echo Build Docker image...
- docker build -t $REPOSITORY_URI .
# Add these lines
- echo Copying Dockerfile & Dockerrun files to dist folder ...
- cp Dockerfile dist/
- cp Dockerrun.aws.json dist/
...
这将把Dockerfile和Dockerrun.aws.json文件复制到名称为“dist”的文件夹中,这是部署应用程序的默认文件夹,CodePipeline应该可以自动识别这些文件。
上一篇:AWSCodepipelineWebhook的正确POST请求体是什么?
下一篇:AWSCodePipelinewithECScontainersusingCodeDeployappspec.ymlfile