跳到主要内容

6.eop托管

最后更新于:

eop托管

背景

这里配置下cnb+eop,域名为teek.onedayxyy.cn

1、仓库配置.cnb.yml

创建.cnb.yml文件:

 1master:
 2  push:
 3    "volume-cache":
 4      name: 云原生构建
 5      runner:
 6        cpus: 64
 7      imports:	
 8        - https://cnb.cool/onedayxyy/secret/-/blob/main/envs.yml
 9      docker:
10        image: node:22
11      stages:
12        - name: set env
13          script: echo -n $(date +%s)
14          exports:
15            info: CUSTOM_ENV_START_TIME
16        - name: 🏠️ 设置淘宝源
17          script: |
18            npm config set registry https://registry.npmmirror.com
19        - name: 🖨️ 打印环境
20          script: |
21            npm install -g pnpm && node -v && npm -v && yarn -v && pnpm -v
22        - name: 📦️ 安装依赖
23          script: |
24            pnpm install
25        - name: ⚗️ 编译项目
26          script: |
27            pnpm docs:build
28        - name: 🚚 部署到Pages
29          image: node:22
30          script: >-
31            npx edgeone@1.0.34 pages deploy ./docs/.vitepress/dist --name
32            vitepress-theme-teek-one --token $EDGEONE_PAGES_API_TOKEN
33
34
35        # #同步仓库到gitee                  
36        # - name: sync to gitee
37        #   image: tencentcom/git-sync
38        #   settings:
39        #     branch: master
40        #     auth_type: https
41        #     username: ${GIT_USERNAME}
42        #     password: ${GIT_ACCESS_TOKEN}
43        #     target_url: https://gitee.com/onlyonexl/vitepress-theme-teek-one-private.git
44        #     # git_email: 'github-actions[bot]@users.noreply.github.com'
45
46        # - name: build knowledge base
47        #   image: cnbcool/knowledge-base
48        #   settings:
49        #     embedding_model: bge-m3
50        #     include: "**/**.md"
51        #     exclude: ""    
52
53        - name: ⏱️ 计算耗时
54          script: |
55            # 计算耗时
56            end_time=$(date +%s)
57            duration=$((end_time - $CUSTOM_ENV_START_TIME))
58            minutes=$((duration / 60))
59            seconds=$((duration % 60))
60            time_str="${minutes}分${seconds}秒"
61            echo -n ${time_str}
62          exports:
63            info: CUSTOM_ENV_BUILD_TIME
64
65            
66        - name: 钉钉通知
67          image: tencentcom/dingtalk-bot-msg:latest
68          settings:
69            content: "「Teek Blog」发布完成,耗时: ${CUSTOM_ENV_BUILD_TIME}"
70            c_type: "text" # 支持: text, markdown, link, actionCard, multiActionCard, feedCard
71            secret: $SECRET
72            webhook: $WEBHOOK
73            isAtAll: false
74            debug: false # 新增: 是否启用调试模式
75
76        # - name: 🔔 发布通知  
77        #   image: tencentcom/wecom-message
78        #   settings:
79        #     robot: ${WECOM_BOT}
80        #     msgType: markdown
81        #     content: |
82        #       > **🎉 One Blog 又一次发布成功啦!**   
83        #       > **构建时间:** $CUSTOM_ENV_DATE_INFO 
84        #       > **构建耗时:** ${CUSTOM_ENV_BUILD_TIME}        
85        #       > **构建id:** $CNB_BUILD_ID  
86        #       > **提交id:** $CNB_COMMIT_SHORT            
87        #       > **构建分支:** $CNB_BRANCH
88        #       > **提交信息:** $CNB_COMMIT_MESSAGE_TITLE
89        #       > **提交者:** $CNB_COMMITTER
90        #       > **仓库地址:** [$CNB_REPO_URL_HTTPS]($CNB_REPO_URL_HTTPS)
91        #       > **我的网站:** [onedayxyy.cn](https://onedayxyy.cn/)            

提交:

1git add -A
2git commit -m"添加.cnb.yml"
3git push

验证:

image-20250924063108079

来到eop上观察下:

image-20250924063130341

2、添加下自定义域名

image-20250924063202638

image-20250924063301992

配置下域名解析:

image-20250924063327035

image-20250924063403879

image-20250924063431514

来到eop验证域名:

image-20250924063450596

然后会自动部署https证书:(耐心等几分钟)

image-20250924063520874

部署OK了:

image-20250924063748160

3、验证

  • 访问域名验证(OK啦啦啦😜)

image-20250924063818466

结束。

最新文章

文档导航