🐞 fix: 修复 Docker 运行出错

This commit is contained in:
imsyy
2024-06-06 16:27:01 +08:00
parent d73ca1170c
commit d4a52a6b24
6 changed files with 42 additions and 13 deletions

View File

@@ -5,9 +5,12 @@ on:
types: [published]
jobs:
push_to_registry:
build-docker:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm/v7, linux/arm64]
permissions:
packages: write
contents: read
@@ -15,6 +18,20 @@ jobs:
- 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
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
@@ -36,7 +53,7 @@ jobs:
imsyy/dailyhot-api
ghcr.io/${{ github.repository }}
- name: Build and push Docker image
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
@@ -44,3 +61,11 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platform }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache