$30 off During Our Annual Pro Sale. View Details »

AWSで構築するDocker環境CI/CD | POST URBAN.inc 難波 啓司

AWSで構築するDocker環境CI/CD | POST URBAN.inc 難波 啓司

KEIJI NAMBA

January 26, 2021
Tweet

Other Decks in Programming

Transcript

  1. Code Pipeline, Code Build, ECR, ECS, Auto Scaling AWSで構築する Docker環境CI/CD

  2. None
  3. ONLY FIVEインフラ

  4. Dockerの CI/CD環境

  5. Code Pipeline Code Build ECS Github Integration ECR Push Images

    Update Task Definition Build Test Push Build docker images. Run tests. Push docker images to ECR. Architecture
  6. None
  7. Code Build ECS Github Integration

  8. IAM リソース権限管理 Code Build ECS Github Integration

  9. None
  10. version: 0.2 phases: install: runtime-versions: docker: 18 pre_build: commands: -

    aws --version - $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) - REPOSITORY_URI=000000000000.dkr.ecr.ap-northeast-1.amazonaws.com/example.com/app - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} build: commands: - docker-compose -f docker-compose.prd.yml build - docker-compose -f docker-compose.prd.yml run app rails test - docker tag app REPOSITORY_URI:$IMAGE_TAG post_build: commands: - docker push $REPOSITORY_URI:$IMAGE_TAG - printf '[{"name":"app","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json artifacts: files: imagedefinitions.json AWS CLIのログインや変数の セットアップ PRE BUILD Dockerイメージのビルドとテス トの実行 BUILD ECRのレポジトリにビルドした イメージをプッシュ POST BUILD
  11. Docker Dockerベースなのでビルド設定は compose buildするだけ

  12. メモリ Build Server Spec メモリ メモリ メモリ

  13. None
  14. Rails Container Nginx Container Auto Scaling Group EC2 Instance

  15. Rails Nginx Rails Nginx Load Balancer ALB

  16. None
  17. None
  18. Code Pipeline Code Build ECS Github Integration ECR Push Images

    Update Task Definition Build Test Push Build docker images. Run tests. Push docker images to ECR. Architecture
  19. None
  20. None
  21. 早いサイクルでリリース 今まで CI/CD

  22. 今後の”時間” に投資する

  23. CREDITS: This presentation template was created by Slidesgo, including icons

    by Flaticon, and infographics & images by Freepik THANKS Do you have any questions? keiji.namba@post-urban.co 070-1877-9900 https://post-urban.co
  24. None