Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions deploy_codebuild/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# aws codebuild start-build --project-name build-codebuild-image-for-node14 > /dev/null

version: 0.2
env:
variables:
AWS_ACCOUNT: 415984593091
AWS_REGION: us-east-1
IMAGE_NAME: codebuild_node14
VERSION_TAG: 14
phases:
install:
commands:
- cd ./ubuntu/standard/5.0
- docker build -t aws/codebuild/standard:5.0 .
build:
commands:
- echo Build started on `date`
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com
- docker tag aws/codebuild/standard:5.0 $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_NAME:$VERSION_TAG
- docker tag aws/codebuild/standard:5.0 $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_NAME:latest
- docker push $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_NAME:$VERSION_TAG
- docker push $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_NAME:latest
58 changes: 58 additions & 0 deletions deploy_codebuild/codebuild-project.cfn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# create codebuild project (from repo)
# aws cloudformation deploy --stack-name "codebuild-image-for-node-14" --capabilities CAPABILITY_NAMED_IAM --template-file ./deploy_codebuild/codebuild-project.cfn.yml

AWSTemplateFormatVersion: "2010-09-09"
Description: codebuild project with associated permissions
Resources:
Project:
Type: AWS::CodeBuild::Project
Properties:
Name: build-codebuild-image-for-node14
Artifacts:
Type: NO_ARTIFACTS
Environment:
ComputeType: BUILD_GENERAL1_MEDIUM
EnvironmentVariables:
- Name: ENVIRONMENT
Type: PLAINTEXT
Value: dev
Image: aws/codebuild/standard:5.0
ImagePullCredentialsType: CODEBUILD
PrivilegedMode: true
Type: LINUX_CONTAINER
ServiceRole: !Ref Role
Source:
Location: https://github.com/kramtechnologies/cognito-aws-codebuild-docker-images
BuildSpec: deploy_codebuild/buildspec.yml
ReportBuildStatus: false
Type: GITHUB
LogsConfig:
CloudWatchLogs:
GroupName: /aws/codebuild
StreamName: build-codebuild-image-for-node-14
Status: ENABLED
TimeoutInMinutes: 5
Role:
Type: AWS::IAM::Role
Properties:
RoleName: codebuild-build-codebuild-image-for-node-14
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: codebuild.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: EnableFullDeployment
PolicyDocument:
Version: 2012-10-17
Statement:
- "Sid": "Admin"
"Effect": "Allow"
"Action":
- "cloudwatch:*"
- "codebuild:*"
- "ecr:*"
- "logs:*"
"Resource": "*"
Loading