60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
name: Publish Docker image to Gitea
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-docker:
|
|
name: Build and push to Gitea Registry (Internal)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write # 必须:允许写入软件包
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
# 👇 告诉 Buildx 这个地址允许 HTTP (insecure)
|
|
driver-opts: network=1panel-network
|
|
config-inline: |
|
|
[registry."172.18.0.21:3000"]
|
|
http = true
|
|
insecure = true
|
|
|
|
- name: Log in to Gitea Registry (Internal)
|
|
uses: docker/login-action@v3
|
|
with:
|
|
# ✅ 修改点1: 使用内网地址,避开 Cloudflare 和 WAF
|
|
registry: 172.18.0.21:3000
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GGITEA_PAT }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
# ✅ 修改点2: 镜像名必须以 gitea:3000 开头,才能推送到内网注册中心
|
|
# Gitea 会自动处理映射,你在外网依然可以用 git.chgr.cc 拉取
|
|
images: 172.18.0.21:3000/${{ github.repository }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |