Created
July 9, 2018 00:04
-
-
Save MitchyBAwesome/f063e7ffa150be6f72fa2f1b9378451c to your computer and use it in GitHub Desktop.
build-spec-for-command-line-pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
phases: | |
pre_build: | |
commands: | |
- echo -n "$CODEBUILD_BUILD_ID" | sed "s/.*:\([[:xdigit:]]\{7\}\).*/\1/" > /tmp/build_id.out | |
- printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out | |
- echo "$(cat /tmp/build_tag.out)" | |
- printf '[{"name":"go-http-server","imageUri":"%s"}]' "$(cat /tmp/build_tag.out)" > imagedefinitions.json | |
- echo Logging in to Amazon ECR... | |
- $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION) | |
build: | |
commands: | |
- echo Build started on `date` | |
- echo Building the Docker image... | |
- docker build --build-arg AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION --build-arg AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI -t "$(cat /tmp/build_tag.out)" . | |
post_build: | |
commands: | |
- echo Build completed on `date` | |
- echo Pushing the Docker image..."$(cat /tmp/build_tag.out)" | |
- docker push "$(cat /tmp/build_tag.out)" | |
artifacts: | |
files: | |
- imagedefinitions.json | |
discard-paths: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment