Nuxt is the React framework for server side rendering static pages built with React https://nextjs.org/
This demo assumes you to know React and have some familiarity with NextJS
- Static page generation with Zesty.io Content via
getStaticPropsusing the zesty content model endpoints
The example assume you can use a terminal and have node and npm installed.
- Clone the Repo to a local folder
- Open terminal at root folder
- Run
npm install - Run
npm run dev - Open
localhost:3000in your browser
Prereqs:
- Install GCloud tools https://cloud.google.com/sdk/docs/install and auth from the command line.
- Know your google cloud project name (our is
zesty-dev) and replace[your-project]reference with that
Look into package.json under scripts you will see
"build-container": "gcloud builds submit --tag gcr.io/zesty-dev/nextjs-zflix --project zesty-dev",
"deploy-cloud-run": "gcloud run deploy nextjs-zflix --image gcr.io/zesty-dev/nextjs-zflix --project zesty-dev --min-instances 1 --platform managed --set-env-vars [env=prod] --region us-central1",
"deploy": "npm run build-container && npm run deploy-cloud-run"
The first line builds a docker image and pushes it to gcp. Its neccesary becasue cloud run deploys a docker image. npm run build-container executes it.
gcloud builds submit --tag gcr.io/[your-project]/nextjs-zflix --project [your-project]
The second line actually deploys the service to cloud run. Note important flags
--min-instances 1keeps one instance running, this is good for faster response times but costs more money--platform manageddeploys to the GCP service--set-env-vars [env=prod]used to determine what env values to load, good for staged vs. published content switches--region us-central1where you deploy to see all here https://cloud.google.com/compute/docs/regions-zones
`gcloud run deploy nextjs-zflix --image gcr.io/[your-project]/nextjs-zflix --project [your-project] --min-instances 1 --platform managed --set-env-vars [env=prod] --region us-central1``
If you are part of the Zesty.io dev team you can deploy using: npm run deploy


