Build angular app and deploy in AWS S3 by Bitbucket Pipeline

Posted By: Matpal - November 11, 2019
Bitbucket provides inbuilt CI/CD functionality as Bitbucket Pipelines to build and deploy the code. This is a serverless CI/CD functionality. Let's see an example of an angular application, that can be built and deploy in an Amazon S3 bucket. 
Followings are the steps

  1. Push code in Bitbucket GIT
  2. Bitbucket pipelines get invoked
  3. Bitbucket pipeline builds code and deploys in AWS S3


# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.3

pipelines:
  default:
    - step:
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - node -v
          - npm -v
          - git --version
          - npm cache clean --force
          - npm i
          - npm install -g @angular/cli
          - ng build --prod --build-optimizer --progress=false
          - cd dist/sample
          - pipe: atlassian/aws-s3-deploy:0.3.5
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              AWS_DEFAULT_REGION: 'us-east-2'
              S3_BUCKET: 's3bucketname'
              LOCAL_PATH: '$(pwd)'
      
         

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.