I have an AWS CodeBuild project, and I need to call the SAM CLI inside my CodeBuild container. In the build
phase, I added a command to install Linux Homebrew, so that I can install the SAM CLI from the AWS Homebrew tap, per the documentation.
However, upon running this command, I am receiving the error below.
[Container] 2020/01/20 05:29:26 Running command bash -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
-e:196: warning: Insecure world writable dir /go/bin in PATH, mode 040777
Don't run this as root!
[Container] 2020/01/20 05:29:28 Command did not exit successfully bash -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" exit status 1
[Container] 2020/01/20 05:29:28 Phase complete: BUILD State: FAILED
[Container] 2020/01/20 05:29:28 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: bash -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)". Reason: exit status 1
I'm using the Ubuntu Standard "3.0" build environment, that AWS provides.
buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
docker: 18
nodejs: 10
python: 3.8
build:
commands:
- echo Installing SAM CLI
- sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
- brew tap aws/tap
- brew install aws-sam-cli
- sam version
Question: How can I successfully install Linux Homebrew inside an AWS CodeBuild project?
sam
has been already in Codebuild containers (sure withpython: 3.8
image), you can skip installaws-sam-cli
viabrew
, just check sam version withsam --version
command – hoangdv