Initial commit: Modular personal toolbox with high-fidelity Chinese stroke order tool and CI/CD
Build and Push Docker Image / build (push) Successful in 2m7s

This commit is contained in:
2026-02-23 02:04:11 -08:00
commit 073bc5e926
22 changed files with 1133 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
name: Build and Push Docker Image
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_HOST: unix:///var/run/docker.sock
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Log in to Gitea Registry
run: echo "${{ secrets.PUSH_TOKEN }}" | docker login git.pengzhan.dev -u "${{ github.actor }}" --password-stdin
- name: Build and push Docker image
run: |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
IMAGE_NAME="git.pengzhan.dev/$REPO_LOWER"
# 获取仓库的完整 URL
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
echo "Building image: $IMAGE_NAME with source link: $REPO_URL"
# 关键点:通过 --label 注入关联信息
docker build \
--network host \
--label "org.opencontainers.image.source=$REPO_URL" \
-t $IMAGE_NAME:latest \
-t $IMAGE_NAME:${{ github.sha }} .
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:${{ github.sha }}