mirror of
https://github.com/239573049/FastGateway.git
synced 2026-10-18 22:51:27 +08:00
d49dca2935
此前 docker-image.yml 只把前端构建到 web/dist,Dockerfile 从未将其 复制到 wwwroot,导致发布镜像的 wwwroot 为空、无法提供前端页面。 - Dockerfile 新增 web 构建阶段(--platform=$BUILDPLATFORM,前端为架构无关 静态文件,多架构构建时只构建一次,避免 QEMU 模拟),并在 publish 前将 产物复制到 src/FastGateway/wwwroot - docker-image.yml 移除冗余的前端构建步骤(改由 Dockerfile 内部完成, 镜像构建自包含,本地 docker build 亦可用) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Docker Image CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main", "master" ]
|
|
pull_request:
|
|
branches: [ "main", "master" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# 前端由 Dockerfile 内的 web 阶段构建(在 $BUILDPLATFORM 上一次构建,
|
|
# 再复制到 wwwroot),此处无需单独构建前端。
|
|
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: aidotnet
|
|
password: ${{ secrets.DOCKER }}
|
|
|
|
- name: Extract short sha
|
|
id: vars
|
|
run: echo "sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push multi-arch
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: src/FastGateway/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: |
|
|
aidotnet/fast-gateway:latest
|
|
aidotnet/fast-gateway:sha-${{ steps.vars.outputs.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|