Compare commits
39 Commits
6f433aebe0
...
v1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3648d1102 | ||
|
|
2360e0b80c | ||
|
|
7878d168e0 | ||
|
|
2ed19e2eab | ||
|
|
779c6b1ae7 | ||
|
|
ff2b1804b4 | ||
|
|
80b201db86 | ||
|
|
55a1dd7d12 | ||
|
|
3afe5c1e9e | ||
|
|
2f9ccd4db1 | ||
|
|
ebb48e9926 | ||
|
|
43a081ecf2 | ||
|
|
12b24dc890 | ||
|
|
acb636c267 | ||
|
|
eb6ca1d7df | ||
|
|
8e49aaad45 | ||
|
|
2b111e2d62 | ||
|
|
106c6e0c34 | ||
|
|
3d6bacbe90 | ||
|
|
9537f614c7 | ||
|
|
7d2e3d8afb | ||
|
|
4ae109af1d | ||
|
|
baa41c5327 | ||
|
|
7f26c3e5ec | ||
|
|
ad8e15faaf | ||
|
|
7cb5c174af | ||
|
|
9545199d90 | ||
|
|
b1d64ef64b | ||
| 7e543935ef | |||
| 14543e0c7b | |||
| 6ee64b1ba3 | |||
|
|
e07b202d61 | ||
|
|
c333fde2e3 | ||
|
|
2e31c0a3d5 | ||
|
|
9c8d3537ad | ||
|
|
18a2f2986b | ||
|
|
80e944cf2b | ||
| cf06cb2ae9 | |||
| 8d66c68e11 |
@@ -2,10 +2,10 @@ name: Build and Push Docker Images
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: [ main, develop ]
|
||||||
tags: [ 'v*' ]
|
tags: [ 'v*' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, master ]
|
branches: [ main, develop ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
@@ -17,9 +17,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
- name: Set up Docker Buildx
|
fetch-depth: 0 # 获取完整的提交历史用于标签生成
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Registry
|
- name: Login to Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -28,6 +28,7 @@ jobs:
|
|||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
# 为后端服务生成元数据
|
||||||
- name: Extract metadata for backend
|
- name: Extract metadata for backend
|
||||||
if: matrix.service == 'backend'
|
if: matrix.service == 'backend'
|
||||||
id: meta-backend
|
id: meta-backend
|
||||||
@@ -35,11 +36,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: gitea.zfxt.top/zfxt/backend
|
images: gitea.zfxt.top/zfxt/backend
|
||||||
tags: |
|
tags: |
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
|
type=sha,prefix=,suffix=,enable=true
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
# 为前端服务生成元数据
|
||||||
- name: Extract metadata for frontend
|
- name: Extract metadata for frontend
|
||||||
if: matrix.service == 'frontend'
|
if: matrix.service == 'frontend'
|
||||||
id: meta-frontend
|
id: meta-frontend
|
||||||
@@ -47,14 +52,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: gitea.zfxt.top/zfxt/frontend
|
images: gitea.zfxt.top/zfxt/frontend
|
||||||
tags: |
|
tags: |
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
|
type=sha,prefix=,suffix=,enable=true
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
# 构建和推送后端镜像
|
||||||
- name: Build and push backend image
|
- name: Build and push backend image
|
||||||
if: matrix.service == 'backend'
|
if: matrix.service == 'backend'
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
file: ./backend/dockerfile
|
file: ./backend/dockerfile
|
||||||
@@ -62,12 +71,13 @@ jobs:
|
|||||||
tags: ${{ steps.meta-backend.outputs.tags }}
|
tags: ${{ steps.meta-backend.outputs.tags }}
|
||||||
labels: ${{ steps.meta-backend.outputs.labels }}
|
labels: ${{ steps.meta-backend.outputs.labels }}
|
||||||
|
|
||||||
|
# 构建和推送前端镜像
|
||||||
- name: Build and push frontend image
|
- name: Build and push frontend image
|
||||||
if: matrix.service == 'frontend'
|
if: matrix.service == 'frontend'
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./front
|
context: ./front
|
||||||
file: ./front/dockerfile
|
file: ./front/dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta-frontend.outputs.tags }}
|
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||||
labels: ${{ steps.meta-frontend.outputs.labels }}
|
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image: gitea.zfxt.top/zfxt/frontend:latest
|
image: gitea.zfxt.top:8443/zfxt/frontend:latest
|
||||||
container_name: my-frontend-web
|
container_name: my-frontend-web
|
||||||
ports:
|
ports:
|
||||||
- "5555:5555"
|
- "5555:5555"
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
# 移除了build配置,因为我们现在使用预构建的镜像
|
# 移除了build配置,因为我们现在使用预构建的镜像
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
image: gitea.zfxt.top/zfxt/backend:latest
|
image: gitea.zfxt.top:8443/zfxt/backend:latest
|
||||||
container_name: my-backend-api
|
container_name: my-backend-api
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
@@ -21,4 +21,4 @@ services:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user