From 4c0647c8507a027b01d962767aef8688f4f3821e Mon Sep 17 00:00:00 2001 From: Tomoya Chiba Date: Mon, 5 Nov 2018 19:27:20 +0900 Subject: [PATCH] Build on CodeBuild instead of CircleCI --- buildspec.yml | 25 +++++++++++++++++++++++++ circle.yml | 30 ------------------------------ 2 files changed, 25 insertions(+), 30 deletions(-) create mode 100644 buildspec.yml delete mode 100644 circle.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000000000..d1df2f5130b372 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,25 @@ +version: 0.2 + +env: + variables: + IMAGE_REPO_NAME: qiitadon +phases: + pre_build: + commands: + - echo Logging in to Amazon ECR... + - $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION) + - AWS_ACCOUNT_ID=`aws sts get-caller-identity --query 'Account' --output text`; + - REPOSITORY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${IMAGE_REPO_NAME} + - IMAGE_TAG=$(echo ${CODEBUILD_RESOLVED_SOURCE_VERSION:-${CODEBUILD_SOURCE_VERSION}} | cut -c 1-10) + build: + commands: + - echo Build started on `date` + - echo Building the Docker image... + - docker build -t ${REPOSITORY_URI}:latest . + - docker tag ${REPOSITORY_URI}:latest ${REPOSITORY_URI}:${IMAGE_TAG} + post_build: + commands: + - echo Build completed on `date` + - echo Pushing the Docker image with ${IMAGE_TAG} and latest tag... + - docker push ${REPOSITORY_URI}:${IMAGE_TAG} + - docker push ${REPOSITORY_URI}:latest diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 931a4888516ed6..00000000000000 --- a/circle.yml +++ /dev/null @@ -1,30 +0,0 @@ -machine: - services: - - docker -general: - branches: - only: - - qiitadon - - increments-mastodon -database: - override: - - echo "Skip database phase" -dependencies: - override: - - echo "Skip dependencies phase" -deployment: - qiitadon: - branch: qiitadon - commands: - - docker build --tag ${AWS_ECR_URL_QIITADON}:${CIRCLE_BUILD_NUM} . - - eval $(aws ecr get-login) - - docker push ${AWS_ECR_URL_QIITADON}:${CIRCLE_BUILD_NUM} - increments-mastodon: - branch: increments-mastodon - commands: - - docker build --tag ${AWS_ECR_URL_INCREMENTS_MASTODON}:${CIRCLE_BUILD_NUM} . - - eval $(aws ecr get-login) - - docker push ${AWS_ECR_URL_INCREMENTS_MASTODON}:${CIRCLE_BUILD_NUM} -test: - override: - - echo "Skip test phase"