- Run
npm i
- Create
.env
file based off.env-template
and fill out env vars. - Run
npm start
andnode server.js
simultaneously.
- Build docker image and run container:
docker build -t myapp . && docker run -p 80:80 -p 3030:3030 myapp
- React app should now be at
http://localhost
- Server should accept requests at
/dbtest
route.
- Find container ID:
docker ps
- Open a shell session in the running container
docker exec -it id /bin/sh
- Navigate to logs folder and print:
cd /var/log && cat node_server.log
- Stop container:
docker stop 123abc456def
- Remove all stopped containers:
docker container prune
- Or remove container by id:
docker rm 123abc456def
- Or remove container by id:
- Remove all hanging images:
docker image prune
Following this guide: https://medium.com/@nwosuonyedikachi/deploying-a-react-app-to-aws-ecs-with-github-actions-5c74c1869800
- Create, setup, and run react site using npx create-react-app
- npm i
- npm start
- Create private repo on Elastic Container Registry (ECR) in AWS.
- name: dev-portfolio-react
- Go to Elastic Container Service(ECS) and Create a Cluster
- name: portfolioCluster
- Create new task definition
- name: DevTaskDefPortfolio
- In 'Container - 1:
- Enter name "DevContainerPortfolio"
- For image URI put image name from ECR in step 2 (https://922671116400.dkr.ecr.us-west-1.amazonaws.com/dev-portfolio-react)
- Create an ECS service for the newly created ECS cluster
- Set name = "DevPortfolioClusterService"
- Select the task we created in previous step
- Create GH actions workflow yml
- Update the
env:
vars in the workflow.yml to contain the real values. - Update the github repo secrets to include
and
.