O'Reilly logo

AWS Automation Cookbook by Nikit Swaraj

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The build stage of CodePipeline is integrated with CodeBuild, and here Codebuild is using BuildSpec.yml as the build command reference file. CodeBuild will pull the latest application code in the build environment, and then create an image of it. While creating image using Dockerfile it also builds the application using mvn. It means the build of application code takes place inside the Dockerfile only. Let's understand it in detail.

 Here we have a BuildSpec.yml file:

version: 0.2env:  variables:  AWS_DEFAULT_REGION: "MENTION YOUR REGION" AWS_ACCOUNT_ID: "MENTION YOUR ACCOUNT ID" IMAGE_REPO_NAME: "MENTION YOUR ECR REPO NAME" IMAGE_TAG: "latest"phases: pre_build: commands: - sudo apt-get update -y && apt-get install jq -y

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required