Deploy angular app in AWS S3 via Bitbucket Pipelines

Posted By: Matpal - November 03, 2019
Bitbucket provides an inbuilt CI/CD tool - Bitbucket pipelines. You can create deployment pipelines that get invoked when you push your code in the Bitbucket git repository.

The beauty of Bitbucket pipelines is there are no CI servers to set up, user management to configure, or repos to synchronize. You just enable Pipelines with a few simple clicks and you're ready to go. Here is an example of how a pipeline builds an angular application and deploys that application to the AWS S3 server.

There are few steps that you need to do prior to that -

1. Enable piplelines in your Bitbucket repository
2. Create S3 Bucket
4. Create AWS Access Key for S3 Bucket

 # 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: '<YOUR_S3_BUCKET>'  
        LOCAL_PATH: '$(pwd)'  

0 comments:

Post a Comment

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