post_build:
commands:
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
- cat <<'EOF' > appspec.json
{
"\"version\"":0.0,
"\"Resources\"":[{
"\"TargetService\"":{
"\"Type\"":"\"AWS::ECS::Service\"",
"\"Properties\"":{
"\"TaskDefinition\"":"\"arn:aws:ecs:ap-southeast-1:414193698200:task-definition/deploy-wmi:1\""
}
}
}]
}
EOF
Hi, how can I create an appspec.json build artifact in codebuild buildspec? I tried above and it doesn't work. The error is:
/codebuild/output/tmp/script.sh: line 8: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
cat: {: No such file or directory
cat: "version":0.0,: No such file or directory
cat: "Resources":[{: No such file or directory
cat: "TargetService":{: No such file or directory
cat: "Type":"AWS::ECS::Service",: No such file or directory
cat: "Properties":{: No such file or directory
cat: "TaskDefinition":"arn:aws:ecs:ap-southeast-1:414193698200:task-definition/deploy-wmi:1": No such file or directory
cat: }: No such file or directory
cat: }: No such file or directory
cat: }]: No such file or directory
cat: }: No such file or directory
cat: EOF: No such file or directory
I have also tried adding infront of { until EOF, but it also doesnt work:
/codebuild/output/tmp/script.sh: line 8: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
cat: {: No such file or directory
cat: "version":0.0,: No such file or directory
cat: "Resources":[{: No such file or directory
cat: "TargetService":{: No such file or directory
cat: "Type":"AWS::ECS::Service",: No such file or directory
cat: "Properties":{: No such file or directory
cat: "TaskDefinition":"arn:aws:ecs:ap-southeast-1:414193698200:task-definition/deploy-wmi:1": No such file or directory
cat: }: No such file or directory
cat: }: No such file or directory
cat: }]: No such file or directory
cat: }: No such file or directory
cat: EOF: No such file or directory
I have also tried putting all in one line ({"version":0.0,...) but my CodeDeploy said the template cant be parsed. Thanks