mirror of
https://ghproxy.net/https://github.com/netcccyun/dnsmgr.git
synced 2026-07-23 12:28:04 +08:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
59 lines
2.1 KiB
YAML
59 lines
2.1 KiB
YAML
# 手动触发:构建多架构镜像(amd64 / arm64),仅推送 latest 至 Docker Hub 与华为云 SWR。
|
||
# Dockerfile 与构建上下文位于 .github/docker/ 目录。
|
||
#
|
||
# 需在仓库 Settings → Secrets 中配置:
|
||
# DOCKERHUB_USERNAME / DOCKERHUB_TOKEN(Docker Hub 访问令牌)
|
||
# HUAWEI_SWR_USERNAME / HUAWEI_SWR_PASSWORD(华为云 SWR 登录凭证,与本地 docker login swr.cn-east-3.myhuaweicloud.com 一致)
|
||
|
||
name: Docker Build
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
build-and-push:
|
||
runs-on: ubuntu-latest
|
||
permissions:
|
||
contents: read
|
||
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v7
|
||
|
||
- name: Set up QEMU
|
||
uses: docker/setup-qemu-action@v4
|
||
|
||
- name: Set up Docker Buildx
|
||
uses: docker/setup-buildx-action@v4
|
||
|
||
- name: Log in to Docker Hub
|
||
uses: docker/login-action@v4
|
||
with:
|
||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||
|
||
- name: Log in to Huawei SWR
|
||
uses: docker/login-action@v4
|
||
with:
|
||
registry: swr.cn-east-3.myhuaweicloud.com
|
||
username: ${{ secrets.HUAWEI_SWR_USERNAME }}
|
||
password: ${{ secrets.HUAWEI_SWR_PASSWORD }}
|
||
|
||
- name: Build and push (Docker Hub + Huawei SWR, latest only)
|
||
uses: docker/build-push-action@v7
|
||
with:
|
||
context: .github/docker
|
||
file: .github/docker/Dockerfile
|
||
platforms: linux/amd64,linux/arm64
|
||
push: true
|
||
# 每次运行唯一,打破「下载源码 + composer」等层的缓存,否则会一直用首次构建时的层
|
||
build-args: |
|
||
CACHE_BUST=${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||
# 避免向仓库推送 attestations;部分镜像仓库(含部分 SWR 场景)无法解析导致 “fail to parse manifest.json”
|
||
provenance: false
|
||
sbom: false
|
||
tags: |
|
||
netcccyun/dnsmgr:latest
|
||
swr.cn-east-3.myhuaweicloud.com/netcccyun/dnsmgr:latest
|
||
cache-from: type=gha
|
||
cache-to: type=gha,mode=max
|