diff --git a/.gitea/workflows/builder-ui.yaml b/.gitea/workflows/builder-ui.yaml new file mode 100644 index 0000000..bdcc513 --- /dev/null +++ b/.gitea/workflows/builder-ui.yaml @@ -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 . \ No newline at end of file diff --git a/Makefile b/Makefile index c1c6274..b1d6204 100644 --- a/Makefile +++ b/Makefile @@ -4,4 +4,7 @@ vertx: docker build -t $(DOCKER_REGISTRY)/sac/sf-vertx -f ./sf-vertx/Dockerfile --push . admin: - docker build -t $(DOCKER_REGISTRY)/sac/sf-admin -f ./sf-admin/Dockerfile --push . \ No newline at end of file + 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 . \ No newline at end of file diff --git a/sf-ui/Dockerfile b/sf-ui/Dockerfile index 0a63bc2..1460c79 100644 --- a/sf-ui/Dockerfile +++ b/sf-ui/Dockerfile @@ -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