Boilerplate for DevNet React Web App https://github.com/CiscoDevNet/React-Web-App-Boilerplate
Make sure you have installed the latest Node.js installed.
Fork
this repo to your github account :https://github.com/CiscoDevNet/React-Web-App-Boilerplate
git clone
your repo to local.git clone https://github.com/[YOUR_GITHUB_ACCOUNT]/React-Web-App-Boilerplate
- Run
npm install
- Start the dev server using
npm start
- Open http://localhost:8080
Modify /app/Router.js
- Import new page at the top :
import Album from './pages/Album';
- Add routing in between
<Switch>
tag :<Route path="/album" component={Album}/>
- Click
Album
link at the top
Run npm run production
Run : docker build -t webapp .
Run : docker run --name webapp -p 8080:80 -it --rm webapp
Run docker rm -f webapp
- Login to dockerhub.com
- Create a repository with the name : webapp.
- Run
docker tag webapp [YOUR_DOCKERHUB_ACCOUNT]/webapp:latest
at your local.
- login to dockerhub. run
docker login
- Run
docker push [YOUR_DOCKERHUB_ACCOUNT]/webapp:latest
Run export KUBECONFIG=config/kubeconfig-trial.yaml
Run kubectl get nodes
You will see something like this :
NAME STATUS ROLES AGE VERSION
gke-workshop-1-default-pool-500fed5f-1rp2 Ready <none> 1d v1.8.8-gke.0
gke-workshop-1-default-pool-500fed5f-83hl Ready <none> 1d v1.8.8-gke.0
gke-workshop-1-default-pool-500fed5f-szj7 Ready <none> 1d v1.8.8-gke.0
Run kubectl run webapp-[YOUR_DOCKERHUB_ACCOUNT] --image [YOUR_DOCKERHUB_ACCOUNT]/webapp:latest --port 80
Run kubectl get deployment
[PROTNUMBER] is a number between 1000 and 10000.
Run kubectl expose deployment webapp-[YOUR_DOCKERHUB_ACCOUNT] --type "LoadBalancer" --target-port=80 --port=[PROTNUMBER]
Run kubectl get service webapp-[YOUR_DOCKERHUB_ACCOUNT]
When the EXTERNAL-IP
become available, access that page : http://[EXTERNAL-IP]:[PROTNUMBER]/