Note: The overall build flow can be used to deploy a Fargate container or setup up an EC2 instance serving the React SPA. The steps are assuming a Linux distribution with an nginx server is being used for the container or EC2 instance. The AWS CLI Commands/Steps can be used to deploy changes to the AWS sandbox until the CI/CD pipeline is in place.
- Install node.js (which comes with the npm package manager) on the build server or docker container (see Dockerfile for reference)
Note: the
default.conf
file for this project is located atnginx/default.conf
- Install an nginx web server with a
default.conf
that works with a React SPA using react router on the build server or container (see Dockerfile for reference). - Navigate to the root directory of the project Note: install project dependencies
npm install
Note: run tests and move to next step if they pass (exit code: 0)npm run test
Note: create production buildnpm run build
- move build folder into the nginx web server directory
/usr/share/nginx/html
- start nginx server