Created
February 5, 2018 14:15
-
-
Save li0nel/ae3280233258d27223bd997da8f426b0 to your computer and use it in GitHub Desktop.
CodeBuild
This file contains hidden or 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
CodeBuildProject: | |
Type: AWS::CodeBuild::Project | |
Properties: | |
Artifacts: | |
Type: CODEPIPELINE | |
Source: | |
Type: CODEPIPELINE | |
BuildSpec: | | |
version: 0.2 | |
phases: | |
pre_build: | |
commands: | |
- $(aws ecr get-login --no-include-email) | |
- TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)" | |
- IMAGE_URI="${REPOSITORY_URI}:${TAG}" | |
build: | |
commands: | |
- docker build --tag "$IMAGE_URI" . | |
post_build: | |
commands: | |
- docker push "$IMAGE_URI" | |
- printf '[{"name":"laravel","imageUri":"%s"}]' "$IMAGE_URI" > images.json | |
artifacts: | |
files: images.json | |
Environment: | |
ComputeType: BUILD_GENERAL1_SMALL | |
Image: aws/codebuild/docker:17.09.0 | |
Type: LINUX_CONTAINER | |
EnvironmentVariables: | |
- Name: AWS_DEFAULT_REGION | |
Value: !Ref AWS::Region | |
- Name: REPOSITORY_URI | |
Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository} | |
Name: !Ref AWS::StackName | |
ServiceRole: !Ref CodeBuildServiceRole |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment