Some checks failed
Build and Push Docker / build (push) Failing after 31s
- 使用 actions/cache 缓存 Docker 构建层,加快构建速度 - 统一缓存路径改为 /tmp/.buildx-cache 以简化管理 - 更新构建缓存的来源和目标目录配置 - 确保构建结束时正确移动缓存文件,避免缓存丢失 docs(gateway): 新增网关插件系统技术方案文档 - 详细描述插件系统的设计目标和核心功能 - 规划基于 Razor Pages 的 Web UI 管理界面 - 设计插件类型接口及生命周期管理方案
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
name: Build and Push Docker
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
REGISTRY: gitea.shtao1.cn
|
|
IMAGE_NAME: fengling/fengling-console
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
|
|
- name: Extract version
|
|
id: version
|
|
run: |
|
|
VERSION=${{ github.ref_name }}
|
|
if [[ $VERSION == v* ]]; then
|
|
VERSION=${VERSION#v}
|
|
fi
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: fengling
|
|
password: ${{ secrets.GITEATOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=sha,prefix=
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=raw,value=${{ steps.version.outputs.version }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: src/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
BUILD_VERSION=${{ steps.version.outputs.version }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
|
|
- name: Move cache
|
|
if: always()
|
|
run: |
|
|
rm -rf /tmp/.buildx-cache
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|