Search

Rolling Update - Fargate

buildspec.yml

version: 0.2 cache: paths: # - "/root/.gradle/caches/**/*" # gradle # - "/root/.m2/**/*" # maven # - "/root/.cache/pip/**/*" # pip # - "/root/.npm/**/*" # npm # - "/root/.nuget/**/*" # nuget # - "/root/.cache/yarn/**/*" # yarn env: variables: AWS_REGION: "REGION" ECR_REPO_NAME: "ECR_REPO_NAME" phases: pre_build: commands: - echo Logging in to Amazon ECR... - AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) - aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com build: commands: - echo Build started on `date` - echo Building the Docker image... - docker build -t $ECR_REPO_NAME . - docker tag $ECR_REPO_NAME:latest $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/$ECR_REPO_NAME:latest post_build: commands: - echo Build completed on `date` - echo Pushing the Docker image... - docker push $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/$ECR_REPO_NAME:latest - echo Writing image definitions file... - printf '[{"name":"$ECR_REPO_NAME","imageUri":"$AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/$ECR_REPO_NAME:latest"}]' > imagedefinitions.json artifacts: files: - imagedefinitions.json
YAML
복사