mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-19 14:31:57 +08:00
chore: Update Docker build workflow and cache handling
This commit is contained in:
parent
7ec4de67a9
commit
01ce23ef23
19
.github/workflows/docker_build.yml
vendored
19
.github/workflows/docker_build.yml
vendored
@ -8,30 +8,23 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [amd64, arm64]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# 设置 Node.js 环境
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
|
||||||
# 安装 pnpm
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 8
|
||||||
|
|
||||||
# 安装依赖
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
# 构建前端项目
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
|
|
||||||
@ -49,7 +42,6 @@ jobs:
|
|||||||
username: woodchen
|
username: woodchen
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
# 添加缓存元数据
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@ -59,15 +51,18 @@ jobs:
|
|||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
type=sha,prefix={{branch}}-
|
type=sha,prefix={{branch}}-
|
||||||
|
|
||||||
# 构建和推送
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./build/Dockerfile
|
file: ./build/Dockerfile
|
||||||
platforms: linux/${{ matrix.platform }}
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=registry,ref=woodchen/clash-and-dashboard:buildcache-${{ matrix.platform }}
|
cache-from: |
|
||||||
cache-to: type=registry,ref=woodchen/clash-and-dashboard:buildcache-${{ matrix.platform }},mode=max
|
type=registry,ref=woodchen/clash-and-dashboard:buildcache-amd64
|
||||||
|
type=registry,ref=woodchen/clash-and-dashboard:buildcache-arm64
|
||||||
|
cache-to: |
|
||||||
|
type=registry,ref=woodchen/clash-and-dashboard:buildcache-amd64,mode=max
|
||||||
|
type=registry,ref=woodchen/clash-and-dashboard:buildcache-arm64,mode=max
|
||||||
|
Loading…
x
Reference in New Issue
Block a user