This is a Next.js template project that uses CNB for cloud-native building and deployment to EdgeOne Pages.
This project provides a starter template for Next.js applications, integrating cloud-native build processes and automatic deployment functionality.
Complete .cnb.yml configuration is as follows:
# Trigger: Push to main branch
main:
push:
# Import environment variables from private repository:
# Reference: https://docs.cnb.cool/en/build/env.html#importing-environment-variables
- imports: https://cnb.cool/saga-2025/edgeone-pages-env/-/blob/main/envs.yml
stages:
# Build current project
- name: Build Current Project
image: node:20
script: node -v && npm install && npm run build
# Deploy the build output to EdgeOne Pages
# The ./out directory is generated by the previous build step
# Reference: https://www.npmjs.com/package/edgeone
- name: Deploy to EdgeOne Pages
image: node:20
script: npx edgeone pages deploy ./out --name my-edgeone-pages-project --token $EDGEONE_API_TOKEN
This project uses Cloud Native Build for automated building. When code is pushed to the main branch, it triggers the following build process:
After the build completes, the project is automatically deployed to EdgeOne Pages through the following process:
./out directorynpx edgeone pages deploy ./out --name my-edgeone-pages-project --token $EDGEONE_API_TOKEN
Obtain your EDGEONE_API_TOKEN from EdgeOne Pages by visiting: https://edgeone.ai/document/177158578324279296