Update README.md #498
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 | |
on: | |
push: | |
branches: [ '*' ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log into registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |