Setup CICD for create react app (S3)
Step 1: Setup for s3 website
Refer to here you can setup: https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html
Step 2: Setup DNS, e.g. cloudfare
After setup CNAME of your website host in AWS S3, you can see your website content “Welcome to my website” base on document below
Step 3: Setup IAM user which can access this bucket
Refer to my other tutorial
Step 4: Setup Deployment variables of your repo
Refer to my other tutorial,
Define Deployment variables
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
S3_BUCKET: $BUCKET_NAME
Step 5: update package.json script, we use max_old_space_size=2048 since the ci server is not a very powerful machine
"build": "react-scripts --max_old_space_size=2048 build",
Step 6: setup bitbucket-pipelines.yml