Skip to content

Instantly share code, notes, and snippets.

@lakshmantgld
Last active June 30, 2018 04:13
Show Gist options
  • Save lakshmantgld/4713c7543defc2e9b050129dce734d9a to your computer and use it in GitHub Desktop.
Save lakshmantgld/4713c7543defc2e9b050129dce734d9a to your computer and use it in GitHub Desktop.
config file for the codeBuild
version: 0.2
phases:
install:
commands:
# Yarn installation
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get -y update
- apt-get install -y yarn
# Installing serverless globally
- yarn global add serverless
- yarn -v
# Installing react and serverless dependencies
- yarn install
- cd serverless && yarn install
pre_build:
commands:
# Pulling the environment files from private bucket
- aws s3 cp s3://<ENV-FILES-BUCKET>/react ../ --recursive
- aws s3 cp s3://<ENV-FILES-BUCKET>/serverless . --recursive
# CloudFront configuration
- aws configure set preview.cloudfront true
build:
commands:
# Building the react app and deploying to S3 bucket, invalidating the CloudFront
- cd ../ && ls -al
- pwd
- yarn $DEPLOY_REACT_BASED_ON_ENV
# - ls -al
# Building the serverless and deploying to APIGateway and Lambda
- yarn $DEPLOY_SERVERLESS_BASED_ON_ENV
# - echo $CODEBUILD_SRC_DIR
# - pwd
# post_build:
# commands:
# – sls deploy –v
artifacts:
files:
- serverless.yml
base-directory: 'serverless'
discard-paths: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment