Initial commit: Modular personal toolbox with high-fidelity Chinese stroke order tool and CI/CD
Build and Push Docker Image / build (push) Successful in 2m48s
Build and Push Docker Image / build (push) Successful in 2m48s
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# 明确指向 K8s 挂载的绝对路径
|
||||
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"
|
||||
|
||||
# 增加构建时的内存优化建议(如果是 Go 编译卡住)
|
||||
echo "Starting Docker build..."
|
||||
docker build --network host -t $IMAGE_NAME:latest -t $IMAGE_NAME:${{ github.sha }} .
|
||||
|
||||
echo "Pushing image..."
|
||||
docker push $IMAGE_NAME:latest
|
||||
docker push $IMAGE_NAME:${{ github.sha }}
|
||||
Reference in New Issue
Block a user