First, we need to setup our workstation to have a docker image that we can use to mimic codebuild in the wild. For this I’ve setup nodejs, but you can browse the binaries and freely use whichever you want.

Below is a simple list of commands to get setup.

Note to self: scripting this may be useful in the future

# Local Codebuild    
Reference: [](

### Locally pull available codebuild images
    git clone

### Browse for the binary you're looking for

    cd aws-codebuild-docker-images
    cd ubuntu/{BINARY}
    docker build -t aws/codebuild/{BINARY}:{VERSION} .

### Pull codebuild locally
    docker pull amazon/aws-codebuild-local:latest --disable-content-trust=false

### Install the codebuild script to do local magic
    chmod +x

### Optionally..
    mv /usr/local/bin/codebuild

## Usage [-i image_name] [-a artifact_output_directory] [options]

### Example Usage
    codebuild -i aws/codebuild/{BINARY}:{VERSION} -a /path/to/artifacts -s /path/to/src

Once installed, the usage is actually brilliantly simple:

codebuild -i aws/codebuild/nodejs:10.14.1 -a /path/to/artifact -s /path/to/src -b /path/to/buildspec.yml
  1. Your path to artifact is where you want the artifact to be “downloaded” to.
  2. Your buildspec can be named anything as long as it follows the conventions; I typically have buildspec.yml for production, and buildspec-{env} for others, because unfortunately codebuild does not support native environment variables for this yet (if it does and I’m missing it, please point me in the right direction!)
Categories: Software