Merge pull request #316 from Fidel2001/main #241
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 Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=sha | |
type=semver,pattern={{tag}} | |
type=semver,pattern={{version}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
file: Dockerfile | |
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} | |
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }} |