Skip to content

fix docker workflow #10

fix docker workflow

fix docker workflow #10

Workflow file for this run

name: Build and push a Docker image to GHCR
# Trigger the workflow on push events, ignoring changes to README.md
# and only for the 'master' and 'guest_accounts' branches
on:
push:
paths-ignore:
- "README.md"
branches:
- master
- guest_accounts
# Set environment variables for the registry and image name
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Set permissions for reading the repository contents and writing packages
permissions:
contents: read
packages: write
steps:
# Checkout the repository code
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Set up QEMU for multi-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
# Set up Docker Buildx for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
# Login to GitHub Container Registry (GHCR)
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags and labels) for the Docker image
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push the Docker image to GHCR
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}