Skip to content

docker

docker #31

name: docker
on:
schedule:
- cron: "0 0 * * *" # everyday at 00:00, UTC+0
jobs:
build:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v3
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/login-action
- name: Login to ACR
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_REGISTRY_USERNAME }}
password: ${{ secrets.ALI_REGISTRY_PASSWORD }}
# https://github.com/docker/metadata-action
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
117503445/yunzai-web
registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
tags: |
type=schedule
type=sha
type=raw,value=nightly
# https://github.com/docker/build-push-action
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}