Skip to content

Commit

Permalink
build-docker.yml, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
perennialtech committed Mar 11, 2024
1 parent d781319 commit 292dffe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Create and publish a Docker image
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:
Expand All @@ -8,48 +10,57 @@ on:
- 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

# Define a matrix to build the image for multiple platforms
strategy:
matrix:
platform: [linux/amd64, linux/arm64]

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

# 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:
Expand Down

0 comments on commit 292dffe

Please sign in to comment.