Skip to content

Bump docker/metadata-action from 4 to 5 (#446) #241

Bump docker/metadata-action from 4 to 5 (#446)

Bump docker/metadata-action from 4 to 5 (#446) #241

Workflow file for this run

name: Docker (arm64)
on:
push:
branches:
- master
tags:
- 'v*'
- 'shengji-v*'
pull_request:
branches:
- 'master'
jobs:
docker:
name: "Build a docker image"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
tags: |
type=semver,pattern={{version}}
type=sha
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
flavor: |
suffix=arm64
# list of Docker images to use as base name for tags
images: |
ghcr.io/rbtying/shengji
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker Layers
uses: actions/cache@v3.3.2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}-arm64
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache