Skip to content

Instantly share code, notes, and snippets.

@jiaaro
Last active March 27, 2020 18:44
Show Gist options
  • Save jiaaro/32f165bd465bfa469b96863000aa7a47 to your computer and use it in GitHub Desktop.
Save jiaaro/32f165bd465bfa469b96863000aa7a47 to your computer and use it in GitHub Desktop.
Set up local testing for codebuild
#!/bin/bash
docker --version
if [[ $? != 0 ]]; then
brew cask install docker
fi
echo "Make sure you have $HOME/bin in your PATH"
mkdir -p ~/bin/
curl https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/local_builds/codebuild_build.sh > ~/bin/codebuild_build.sh
chmod +x ~/bin/codebuild_build.sh
git clone https://github.com/aws/aws-codebuild-docker-images.git
cd aws-codebuild-docker-images/ubuntu/python/3.6.5
docker build -t aws/codebuild/python:3.6.5 .
echo "Resources:"
echo " Build Spec ref: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html"
echo " Codebuild images repo: https://github.com/aws/aws-codebuild-docker-images"
echo ""
echo "Play in the docker container to test stuff:"
echo " $ docker run -it --entrypoint sh aws/codebuild/python:3.6.5 -c bash"
echo ""
echo "Test local builds by changing into the directory with your buildspec.yml and running:"
echo ""
echo " $ codebuild_build.sh -i aws/codebuild/python:3.6.5 -a ~/build_artifacts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment