Compare commits

..

39 Commits

Author SHA1 Message Date
小贺
cc4620d52c 变更变量存储位置
All checks were successful
Build and Push Docker Images / build-and-push (backend) (push) Successful in 19s
Build and Push Docker Images / build-and-push (frontend) (push) Successful in 19s
2025-09-04 12:59:43 +08:00
小贺
fceba10cf5 精简镜像 2025-09-04 12:57:18 +08:00
zfxt-ubuntu
c3648d1102 修改镜像名可以直接运行
All checks were successful
Build and Push Docker Images / build-and-push (backend) (push) Successful in 17s
Build and Push Docker Images / build-and-push (frontend) (push) Successful in 18s
2025-09-04 12:44:27 +08:00
小贺
2360e0b80c 完成配置,镜像名不带端口
All checks were successful
Build and Push Docker Images / build-and-push (backend) (push) Successful in 37s
Build and Push Docker Images / build-and-push (frontend) (push) Successful in 20s
2025-09-04 12:07:54 +08:00
小贺
7878d168e0 修改8443端口
All checks were successful
Build and Push Docker Images / build-and-push (backend) (push) Successful in 18s
Build and Push Docker Images / build-and-push (frontend) (push) Successful in 18s
2025-09-04 11:37:55 +08:00
小贺
2ed19e2eab 恢复原样,测试
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 16s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 17s
2025-09-04 11:36:02 +08:00
小贺
779c6b1ae7 使用最新buildpush,增加setup
Some checks failed
ci / docker (push) Failing after 2m3s
2025-09-04 11:31:14 +08:00
小贺
ff2b1804b4 去除注册过程
Some checks failed
ci / docker (push) Failing after 17s
2025-09-04 11:28:49 +08:00
小贺
80b201db86 又添加setup,尝试多平台构建
Some checks failed
ci / docker (push) Failing after 6m49s
2025-09-04 11:18:56 +08:00
小贺
55a1dd7d12 添加多平台构建
All checks were successful
ci / docker (push) Successful in 18s
2025-09-04 11:16:43 +08:00
小贺
3afe5c1e9e 还是不用set up buildx
All checks were successful
ci / docker (push) Successful in 13s
2025-09-04 11:14:35 +08:00
小贺
2f9ccd4db1 尝试先登录,在使用buildx
Some checks failed
ci / docker (push) Failing after 1m2s
2025-09-04 11:12:51 +08:00
小贺
ebb48e9926 测试
Some checks failed
ci / docker (push) Failing after 1m0s
2025-09-04 10:56:47 +08:00
小贺
43a081ecf2 修改key键值
Some checks failed
ci / docker (push) Failing after 1m0s
2025-09-04 10:55:26 +08:00
小贺
12b24dc890 token
Some checks failed
ci / docker (push) Failing after 1m1s
前缀
2025-09-04 10:53:23 +08:00
小贺
acb636c267 点错了 2025-09-04 10:51:33 +08:00
小贺
eb6ca1d7df 尝试修改校验方式
Some checks failed
ci / docker (push) Has been cancelled
2025-09-04 10:51:08 +08:00
小贺
8e49aaad45 wuyv
Some checks failed
ci / docker (push) Failing after 1m5s
2025-09-04 10:38:33 +08:00
小贺
2b111e2d62 校验buildx
Some checks failed
ci / docker (push) Failing after 21s
2025-09-04 10:34:35 +08:00
小贺
106c6e0c34 检测buildx问题
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 2m17s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m14s
2025-09-04 10:27:15 +08:00
小贺
3d6bacbe90 完善最后的测试2
All checks were successful
Build and Push Docker Images / build-and-push (backend) (push) Successful in 20s
Build and Push Docker Images / build-and-push (frontend) (push) Successful in 29s
2025-09-04 10:23:48 +08:00
小贺
9537f614c7 完善最后的测试
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 15s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 15s
2025-09-04 10:13:02 +08:00
小贺
7d2e3d8afb 添加id
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 18s
2025-09-04 10:06:50 +08:00
小贺
4ae109af1d 去除buildx,添加metadata进行测试
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 11s
2025-09-04 10:05:28 +08:00
小贺
baa41c5327 校验buildx是否有问题
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 57s
2025-09-04 10:01:20 +08:00
小贺
7f26c3e5ec 修改镜像名称
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 1m1s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m6s
2025-09-04 09:53:03 +08:00
小贺
ad8e15faaf 尝试不适用元数据
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 59s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m11s
2025-09-04 09:47:57 +08:00
小贺
7cb5c174af 尝试去除多余元数据2
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 1m1s
Build and Push Docker Images / build-and-push (frontend) (push) Has been cancelled
2025-09-04 09:45:07 +08:00
小贺
9545199d90 尝试去除多余元数据
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 21s
Build and Push Docker Images / build-and-push (frontend) (push) Has been cancelled
2025-09-04 09:43:42 +08:00
小贺
b1d64ef64b 第二天测试
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 1m1s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m13s
2025-09-04 09:40:12 +08:00
7e543935ef 测试构建插件
Some checks failed
Build and Push Docker Images / build-and-push (frontend) (push) Has been cancelled
Build and Push Docker Images / build-and-push (backend) (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Successful in 12s
2025-09-03 23:08:49 +08:00
14543e0c7b 测试构建插件
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 11s
Build and Push Docker Images / build-and-push (frontend) (push) Has started running
2025-09-03 23:08:12 +08:00
6ee64b1ba3 随便了
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 11s
Build and Push Docker Images / build-and-push (frontend) (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Successful in 49s
2025-09-03 22:58:26 +08:00
小贺
e07b202d61 乱来了
Some checks failed
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 18s
Build and Push Docker Images / build-and-push (backend) (push) Failing after 42s
2025-09-03 22:48:53 +08:00
小贺
c333fde2e3 测试是否元信息出错
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 2m5s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 2m13s
2025-09-03 21:49:19 +08:00
小贺
2e31c0a3d5 恢复原状,已经修改nginx
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Has been cancelled
Build and Push Docker Images / build-and-push (frontend) (push) Has been cancelled
2025-09-03 21:44:24 +08:00
小贺
9c8d3537ad 删除https协议
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 1m31s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m25s
2025-09-03 21:04:05 +08:00
小贺
18a2f2986b 尝试修改端口
Some checks failed
Build and Push Docker Images / build-and-push (backend) (push) Failing after 20s
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 19s
2025-09-03 21:00:08 +08:00
小贺
80e944cf2b 测试
Some checks failed
Build and Push Docker Images / build-and-push (frontend) (push) Failing after 1m45s
Build and Push Docker Images / build-and-push (backend) (push) Failing after 1m17s
2025-09-03 20:25:22 +08:00
3 changed files with 21 additions and 18 deletions

View File

@@ -2,10 +2,10 @@ name: Build and Push Docker Images
on:
push:
branches: [ main ]
branches: [ main, develop ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
branches: [ main, develop ]
jobs:
build-and-push:
@@ -17,17 +17,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
fetch-depth: 0 # 获取完整的提交历史用于标签生成
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: gitea.zfxt.top
username: ${{ secrets.REGISTRY_USERNAME }}
username: ${{ vars.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# 为后端服务生成元数据
- name: Extract metadata for backend
if: matrix.service == 'backend'
id: meta-backend
@@ -35,11 +36,11 @@ jobs:
with:
images: gitea.zfxt.top/zfxt/backend
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# 为前端服务生成元数据
- name: Extract metadata for frontend
if: matrix.service == 'frontend'
id: meta-frontend
@@ -47,14 +48,14 @@ jobs:
with:
images: gitea.zfxt.top/zfxt/frontend
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# 构建和推送后端镜像
- name: Build and push backend image
if: matrix.service == 'backend'
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ./backend
file: ./backend/dockerfile
@@ -62,12 +63,13 @@ jobs:
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
# 构建和推送前端镜像
- name: Build and push frontend image
if: matrix.service == 'frontend'
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ./front
file: ./front/dockerfile
push: true
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
labels: ${{ steps.meta-frontend.outputs.labels }}

1
README
View File

@@ -0,0 +1 @@
第一次尝试构建CICD及完整docker镜像

View File

@@ -2,7 +2,7 @@ version: '3.8'
services:
frontend:
image: gitea.zfxt.top/zfxt/frontend:latest
image: gitea.zfxt.top:8443/zfxt/frontend:latest
container_name: my-frontend-web
ports:
- "5555:5555"
@@ -13,7 +13,7 @@ services:
# 移除了build配置因为我们现在使用预构建的镜像
backend:
image: gitea.zfxt.top/zfxt/backend:latest
image: gitea.zfxt.top:8443/zfxt/backend:latest
container_name: my-backend-api
networks:
- app-network
@@ -21,4 +21,4 @@ services:
networks:
app-network:
driver: bridge
driver: bridge