ci(sf-ui): 添加 UI 项目的 Docker 镜像构建和推送流程
Some checks failed
Build and Push Docker Image / build (push) Failing after 24s

- 新增 builder-ui.yaml 工作流,用于在 Gitea 上构建和推送 Docker 镜像
- 在 Makefile 中添加 ui 目标,支持本地构建
- 更新 sf-ui/Dockerfile,使用多阶段构建以减小镜像大小
This commit is contained in:
jun 2025-05-16 06:24:24 -04:00
parent 36010ea742
commit 5a2a299bb2
3 changed files with 40 additions and 3 deletions

View File

@ -0,0 +1,26 @@
name: Build and Push Docker Image
on:
push:
branches:
- main # 触发分支
- ca_router
- "releases/*" # 可选通配符
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: docker/checkout@v4
- name: Login to docker.yzj
uses: docker/login-action@v3
with:
registry: docker.yzj
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 构建 Docker 镜像
run:
cd sf-ui && docker build -t docker.yzj/sac/sf-ui -f ./Dockerfile --push .

View File

@ -5,3 +5,6 @@ vertx:
admin:
docker build -t $(DOCKER_REGISTRY)/sac/sf-admin -f ./sf-admin/Dockerfile --push .
ui:
cd sf-ui && docker build -t $(DOCKER_REGISTRY)/sac/sf-ui -f ./Dockerfile --push .

View File

@ -1,6 +1,14 @@
FROM node:24-alpine AS builder
WORKDIR /app
COPY . .
RUN npm install --registry=https://registry.npmmirror.com && npm run build:stage
FROM registry.zsmarter.com/public/nginx:1.22.1
COPY ./sf-ui/dist /app/nginx/html
COPY ./sf-ui/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist /app/nginx/html
COPY --from=builder /app/nginx.conf /etc/nginx/nginx.conf
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories