From bc5b1d25b14d7f682caa0b4ff53c17e00f288e4a Mon Sep 17 00:00:00 2001 From: Ronnie Vega Date: Sun, 8 Sep 2024 16:54:53 -0700 Subject: [PATCH] Add buildspec.yml --- buildspec.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000..181d92d --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,34 @@ +version: 0.2 + +phases: + install: + commands: + - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 & + - timeout 15 sh -c "until docker info; do echo .; sleep 1; done" + pre_build: + commands: + - echo log in to Amazon ECR... + - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username $ECR_LOGIN_USER --password-stdin $ECR_LOGIN_PASS + - REPOSITORY_URI=$REPO_URL + - IMAGE_TAG=${COMMIT_HASH:=latest} + build: + commands: + - echo Build started on `date` + - echo Building the Docker image. + - echo log in to Amazon ECR... + - aws --version + - docker build -t $REPO_NAME . + - docker tag $REPO_NAME:latest $REPOSITORY_URI:latest + post_build: + commands: + - echo Build completed on `date` + - docker push $REPOSITORY_URI:latest + - printf '[{"name":"main-service","imageUri":"%s"}]' $REPOSITORY_URI:latest > imagedefinitions.json +artifacts: + files: imagedefinitions.json + +cache: + paths: + - '/root/.docker/cli-plugins' + - '/root/.npm/**/*' + - 'dist/**/*'