Skip to content

Instantly share code, notes, and snippets.

@mazhar266
Last active November 20, 2019 06:54
Show Gist options
  • Save mazhar266/74152156ce98bb133de41ea082ee60ca to your computer and use it in GitHub Desktop.
Save mazhar266/74152156ce98bb133de41ea082ee60ca to your computer and use it in GitHub Desktop.
AWS CodeDeploy buildspec.yml for auto deploying AWS ECS from AWS ECR via AWS CodePipeline
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
build:
commands:
- REPOSITORY_URI=$(cat imageDetail.json | python -c "import sys, json; print(json.load(sys.stdin)['ImageURI'].split('@')[0])")
- IMAGE_TAG=$(cat imageDetail.json | python -c "import sys, json; print(json.load(sys.stdin)['ImageTags'][0])")
- echo $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Writing image definitions file...
- printf '[{"name":"task_name_here","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment