Skip to content

Instantly share code, notes, and snippets.

@gustavoapolinario
Last active December 26, 2018 23:49
Show Gist options
  • Save gustavoapolinario/9b9a0bba4b3d05977b1e234c72591c37 to your computer and use it in GitHub Desktop.
Save gustavoapolinario/9b9a0bba4b3d05977b1e234c72591c37 to your computer and use it in GitHub Desktop.
sample Cloudformation CodeBuild docker
AWSTemplateFormatVersion: "2010-09-09"
Description: Example of Cloudformation to Build with CodeBuild an application. Get Code commit repo and build a docker container. Your repo needs the buildspec.yml file.
Parameters:
RepositoryName:
Description: CodeComit repository name
Type: String
Resources:
CodeBuildRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
Effect: Allow
Principal:
Service: codebuild.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AdministratorAccess
TodoFrontendBuild:
Type: AWS::CodeBuild::Project
DependsOn: CodeBuildRole
Properties:
Artifacts:
Type: no_artifacts
Environment:
ComputeType: BUILD_GENERAL1_SMALL
Image: aws/codebuild/docker:17.09.0
Type: LINUX_CONTAINER
Name: !Sub ${RepositoryName}CodeBuild
ServiceRole: !Ref CodeBuildRole
TimeoutInMinutes: 15
Source:
Type: CODECOMMIT
Location:
Fn::Join:
- ""
- - "https://git-codecommit."
- Ref: AWS::Region
- ".amazonaws.com/v1/repos/"
- Ref: RepositoryName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment