Files
forumlify/.github/workflows/docker-ghcr.yml
T
lezi-fun 1cfc61ff45 ci: node 24 + per-platform jobs (linux-amd64, linux-arm64, win64)
- Dockerfile/Dockerfile.windows: node 20 → 24
- 3 parallel jobs: linux/amd64, linux/arm64 (buildx, -arch tags),
  win64 (windows-latest native Windows containers, :next-windows)
- winarm64 dropped (no official Windows ARM64 node base image)
2026-08-11 19:05:48 +08:00

101 lines
2.9 KiB
YAML

name: Build & Push Docker to GHCR
on:
push:
branches: [next, main]
tags: ['v*']
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
linux-amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=git-
- name: Build & push linux/amd64
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}-amd64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64
linux-arm64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=git-
- name: Build & push linux/arm64
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/arm64
tags: ${{ steps.meta.outputs.tags }}-arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64
win64:
runs-on: windows-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# windows-latest runner 原生以 Windows 容器模式运行 Docker Engine
- name: Build Windows image (amd64)
shell: pwsh
run: |
docker build -f Dockerfile.windows -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-windows .
- name: Push Windows image
shell: pwsh
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-windows