logo
0
0
Login
Forkfromarsrna/next-cnb-eo-demo, behind:main1 commits

CNB-EO

This project supports automatically packaging and deploying to Edgeone Pages on push.

Configuration

Go to the Edgeone Pages console

Click Create Project - Upload Directly

Set the project name and select any template (it does not affect subsequent deployment, but it must be selected, otherwise you cannot proceed to the next step)

Click Start Deployment

After that, you can set the domain name yourself, refer to: https://edgeone.ai/zh/document/175201436224495616?product=edgedeveloperplatform

CNB Pipeline Configuration

Create a new .cnb.yml, and configure the push section as follows:

push: eo_deploy: runner: cpus: 32 stages: - name: Build image: node:20-alpine script: # This is the command required for nextjs build - npm i -g pnpm - pnpm i - npm run build - name: Deploy my eo pages production environment imports: # Import the Edgeone key here, you can click API Token to create a new one in the eopages console # This is the import variable function provided by cnb, the file content is EO_SECRET: xxxxxxxxxxxxxxxxx - Your key repository path image: tencentcom/deploy-eopages:latest # You need to use your EO_SECRET here, which has been explained above in imports script: edgeone pages deploy ./out -n Your project name -t $EO_SECRET

You need to click APIToken in the EO Pages console to create a new Token for CNB deployment.

It is recommended to use the key repository method to import, creation and usage method: https://docs.cnb.cool/zh/repo/secret.html

This variable can be used as a parameter to pass when deploying the eopages production environment, which is more secure.

Embedded Project

  • Copy the configuration of the push stage in cnb.yml to the cnb configuration of the project
  • Modify the configuration of the eo_deploy stage in .cnb.yml, as explained above
  • Modify the output of the project next.config.ts to export to package static pages for deployment
  • Push the code to cnb for automatic deployment

About

nextjs项目+cnb构建+eopages部署的demo

Language
Markdown41.9%
TypeScript20.1%
gitignore15.1%
CSS6.5%
Others16.4%