docker image build #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'docker image build' | |
on: | |
schedule: | |
- cron: "0 0 */7 * *" # 每7天运行一次 | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # 升级到支持 Node.js 20 的 v4 版本 | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 # 升级到支持 Node.js 20 的 v3 版本 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 # 升级到支持 Node.js 20 的 v3 版本 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 # 升级到支持 Node.js 20 的 v3 版本 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag to lowercase | |
id: lowercase_tag | |
run: | | |
TAG=ghcr.io/${{ github.repository_owner }}/looking-glass-server:latest | |
echo "TAG=$(echo $TAG | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v4 # 升级到支持 Node.js 20 的 v4 版本 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ${{ env.TAG }} |