Skip to content

Build and Publish Containers #297

Build and Publish Containers

Build and Publish Containers #297

name: Build and Publish Containers
on:
push:
branches: [main, unstable]
tags: ['v*']
pull_request:
workflow_dispatch:
schedule:
- cron: '29 13 * * *' # run daily
jobs:
build_docker_containers:
runs-on: ubuntu-latest
steps:
- name: Runner Info
run: printenv | sort
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0' # need full history to get version from git tag
- name: Container metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
# Add support for more platforms with QEMU - https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}