Let’s discuss the build and deploy an Angular application using the AWS code pipeline.

Create Buildspec.yaml

First create the “buildspec.yaml” file in the root directory of the angular application.

version: 0.1

phases:
  install:
    commands:
      - echo installing nodejs...
      - curl -sL https://deb.nodesource.com/setup_12.x | bash -
      - apt-get install -y nodejs
      - echo installing yarn...
      - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
      - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
      - apt install --no-install-recommends yarn
  pre_build:
    commands:
      - echo installing dependencies...
      - npm i -g @angular/cli
      - npm install
  build:
    commands:
      # - echo testing...
      # - echo building...
      - ng build --prod
artifacts:
  files:
    - "**/*"
  discard-paths: no
  base-directory: dist/your-angular-app-name

Create AWS Codepipeline

Now create AWS Codepipeline by following the below screenshots

Give appropiate name to your codepipeline
Connect Github – next choose Repository & Branch
Create a project or choose the existing project

Create Project (if not exists)

Create Project then Continue to CodePipeline

Choose Deploy Provider

Choose the deploy provider – example Amazon S3

Then Click on “Extract file before deploy”

Finally Create Pipeline

Congrats! Your AWS CodePipeline is created and ready to use, Now you just push to GitHub and it will be automatically build and deployed to S3.

This article has 1 comments

  1. Pingback: AWS Codepipeline for Fargate in Production, Testing, and Development Environment | Blogs By Adesh Singh

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.