ci(docker): 更新 Docker 构建和发布工作流

-为不同的服务添加构建矩阵,支持 facade、auth 和 user 服务- 更新镜像名称,包含服务名称后缀
- 修改构建上下文,针对每个服务单独构建
This commit is contained in:
suyiiyii 2025-01-20 23:39:54 +08:00
parent e3aa2b22da
commit 40a270c9d6
Signed by: suyiiyii
GPG Key ID: 044704CB29B8AD85

View File

@ -24,6 +24,9 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [ "facade", "auth" ,"user" ]
permissions:
contents: read
packages: write
@ -65,7 +68,7 @@ jobs:
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.service }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
@ -73,7 +76,7 @@ jobs:
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
context: app/${{ matrix.service }}/.
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}