Files
my-docs/.github/workflows/buidl_and_push_ghcr.yml
gitea_admin e9d42ec4bb
Some checks failed
Docker Image CI / build (push) Failing after 12s
更新 .github/workflows/buidl_and_push_ghcr.yml
2025-12-18 05:21:58 +00:00

53 lines
1.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Docker Image CI
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
# 声明 DinD 服务
services:
docker:
image: docker:dind
options: --privileged
ports:
- 2375:2375
container:
image: catthehacker/ubuntu:act-latest
env:
# 【修改点 1】在 K8s Pod 中sidecar 容器即 localhost
DOCKER_HOST: tcp://localhost:2375
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# 【修改点 2】显式指定 endpoint 为 localhost
driver-opts: image=moby/buildkit:master
endpoint: tcp://localhost:2375
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ gitea.server_url }}
username: ${{ gitea.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
${{ gitea.server_url }}/${{ gitea.actor }}/my-docs:latest
${{ gitea.server_url }}/${{ gitea.actor }}/my-docs:${{ gitea.sha }}