Skip to content

shogo82148/codebuild-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codebuild-golang

Golang Docker Image for CodeBuild

Purpose

It is a CodeBuild custom image including Golang runtime, based on AWS CodeBuild curated Docker images. This image is optimized to Golang project.

Usage

Pre-built images are available on DockerHub.

Docker Pull Command:

# standard 5.0 based
docker pull shogo82148/codebuild-golang:1.22-standard-5.0
docker pull shogo82148/codebuild-golang:1.21-standard-5.0

# standard 4.0 based
docker pull shogo82148/codebuild-golang:1.22-standard-4.0
docker pull shogo82148/codebuild-golang:1.21-standard-4.0

# standard 3.0 based
docker pull shogo82148/codebuild-golang:1.22-standard-3.0
docker pull shogo82148/codebuild-golang:1.21-standard-3.0

# amazonlinux2-x86_64-standard 3.0 based
docker pull shogo82148/codebuild-golang:1.22-amazonlinux2-3.0
docker pull shogo82148/codebuild-golang:1.21-amazonlinux2-3.0

# amazonlinux2-x86_64-standard 2.0 based
docker pull shogo82148/codebuild-golang:1.22-amazonlinux2-2.0
docker pull shogo82148/codebuild-golang:1.21-amazonlinux2-2.0

An Example of CloudFormation Template for Creating CodeBuild Project

CodeBuildProject:
  Type: AWS::CodeBuild::Project
  Properties:
    Artifacts:
      Type: NO_ARTIFACTS
    Environment:
      ComputeType: BUILD_GENERAL1_SMALL
      Image: shogo82148/codebuild-golang:1.22-standard-5.0
      Type: LINUX_CONTAINER
    ServiceRole: !GetAtt CodeBuildRole.Arn
    Source:
      Type: GITHUB
      ReportBuildStatus: true
      Location: https://github.com/shogo82148/codebuild-golang
    TimeoutInMinutes: 10
CodeBuildRole:
  Type: AWS::IAM::Role
  Properties:
    AssumeRolePolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Effect: Allow
          Principal:
            Service: codebuild.amazonaws.com
          Action: "sts:AssumeRole"
    Path: "/"
    Policies:
      - PolicyDocument:
          Statement:
            - Action:
                - logs:CreateLogGroup
                - logs:CreateLogStream
                - logs:PutLogEvents
                - logs:DescribeLogStreams
              Effect: Allow
              Resource: arn:aws:logs:*:*:*
          Version: 2012-10-17
        PolicyName: cloudWatchLogsPolicy

RELATED WORK