diff --git a/.cnb.yml b/.cnb.yml index c33a376..a695d1c 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -51,6 +51,7 @@ $: script: git pull gitea main - name: '提交到原本的origin' script: git push origin main + main: web_trigger_sync_to_gitea: - <<: *common_sync_to_gitea @@ -59,4 +60,15 @@ main: api_trigger_sync_to_gitea: - <<: *common_sync_to_gitea api_trigger_sync_from_gitea: - - <<: *common_sync_from_gitea \ No newline at end of file + - <<: *common_sync_from_gitea + push: + - services: + - docker + stages: + - name: 打包应用 + script: npm run build + # 同名镜像构建&推送 + - name: Docker build + script: docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest . + - name: Docker push + script: docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e69de29..eba68f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,13 @@ +# 使用官方 Nginx 镜像作为基础 +FROM nginx:alpine + +# 删除默认的 Nginx 配置 +RUN rm -rf /usr/share/nginx/html/* + +# 将构建好的静态文件复制到 Nginx 目录 +COPY blog/public /usr/share/nginx/html + +# 暴露 80 端口 +EXPOSE 80 + +# 启动 Nginx \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..7aad89d --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "@abearxiong/blog", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "cd blog && pnpm build" + }, + "keywords": [], + "author": "", + "license": "ISC", + "packageManager": "pnpm@10.28.0" +}