From 29aac83f7ca1073c2a1ae7ab31d22c51344a8fd1 Mon Sep 17 00:00:00 2001 From: Andrew Hobson Date: Thu, 2 Sep 2021 11:34:58 -0400 Subject: [PATCH] Add codebuild config --- buildspec.yml | 7 +++++++ scripts/codebuild | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 buildspec.yml create mode 100755 scripts/codebuild diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000..7e067bee --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,7 @@ +version: 0.2 + +phases: + build: + on-failure: ABORT + commands: + - ./scripts/codebuild diff --git a/scripts/codebuild b/scripts/codebuild new file mode 100755 index 00000000..a0e58972 --- /dev/null +++ b/scripts/codebuild @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail +set -x + +echo "${DOCKER_PASSWORD}" | \ + docker login --username "${DOCKER_USERNAME}" --password-stdin + +docker build -t "${ECR_REPO}:exp" . + +aws ecr get-login-password --region $AWS_REGION \ + | docker login --username AWS --password-stdin "${ECR_REPO}" + +docker push "${ECR_REPO}:exp" + +aws ecs update-service \ + --cluster loadtesting \ + --service exp-web \ + --task-definition exp-web-loadtesting:3 \ + --desired-count 1 + +exit 0