logo
0
0
Login
Forkfromsaga-2025/edgeone-pages, ahead:main3 commits

Next.js Project Deployment to EdgeOne Pages

This is a Next.js template project that uses CNB for cloud-native building and deployment to EdgeOne Pages.

Project Overview

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

Step 1: Cloud Native Build

This project uses Cloud Native Build for automated building. When code is pushed to the main branch, it triggers the following build process:

  1. Import necessary environment variables
  2. Build the project using Node.js 20 environment
  3. Deploy the build output to EdgeOne Pages

Step 2: EdgeOne Pages Deployment

After the build completes, the project is automatically deployed to EdgeOne Pages through the following process:

  1. The build phase generates the ./out directory
  2. The EdgeOne command line tool is used for deployment:
    npx 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

More examples

References

About

This project demonstrates how to build with cnb and publish to edgeone pages.

Language
TypeScript37.7%
Markdown36.1%
gitignore11.2%
CSS10.3%
Others4.7%