Skip to content

toddlers/codebuild-custom-docker-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

codebuild-custom-docker-image

Building custom docker image with tools for codebuild projects.

As pulling the docker images from dockerhub got throttled, so there is a high chance whenever we want to build something , we might get into this trouble. So CFN templates takes care of that. It creates following things for building the automation:

  1. ECR(EC2 Container Registry)
  2. A CodeBuild Project with buildpec inside for installing various tools like below which can be adjusted via the Makefile
  • Terraform
  • Tfenv
  • Boto3
  • Configures Python3
  • Golang
  • Jq
  • Unzip
  1. A CloudWatch Crontab entry to invoke the CodeBuild Job at midnight
  2. A CloudWatch event Rule catches the CodeBuild status for following states:
  • FAILED
  • STOPPED
  • SUCCEEDED
  1. Event Rule subscribed to a SNS Topic
  2. And then AWS Chatbot receives notifications from above SNS topic eventually send them to Configured Slack Channel.

The idea can be further refined to have a custom lambda deployed and subscribed to cloudwatch events for codebuild status updates, process the status maybe add more metadata to it and send the notification via slack or SES.

Note:

  • As of now AWS Chabot is not supported via terraform[1] because there is no support via AWS Go SDK[2]. So this might look more cleaner in terraform.
  • There might be in future AWS will deliver Public Container Registry[3], till then this helps us to keep things running.
  1. hashicorp/terraform-provider-aws#12304
  2. aws/aws-sdk-go#3582
  3. https://aws.amazon.com/blogs/containers/advice-for-customers-dealing-with-docker-hub-rate-limits-and-a-coming-soon-announcement/