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