docker-pi-hole-base build #201
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-pi-hole-base build | |
on: | |
pull_request: | |
paths: | |
- 'docker-pi-hole-base/**' | |
- '.github/workflows/docker-pi-hole-base.yml' | |
push: | |
branches: | |
- "master" | |
paths: | |
- 'docker-pi-hole-base/**' | |
- '.github/workflows/docker-pi-hole-base.yml' | |
workflow_dispatch: | |
schedule: | |
# 1:30am UTC every Sunday, has no particular significance | |
- cron: "30 1 * * 0" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { DEBIAN_VERSION: bullseye-slim, PLATFORMS: 'linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le' } | |
- { DEBIAN_VERSION: bookworm-slim, PLATFORMS: 'linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le' } | |
name: ${{ matrix.job.DEBIAN_VERSION }} | |
steps: | |
- | |
name: Checkout Repo | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKERHUB_NAMESPACE }}/docker-pi-hole-base,enable=${{ github.event_name != 'pull_request' }} | |
ghcr.io/${{ github.repository_owner }}/docker-pi-hole-base,enable=${{ github.event_name != 'pull_request' }} | |
foo/bar,enable=${{ github.event_name == 'pull_request' }} | |
tags: | | |
${{ matrix.job.DEBIAN_VERSION }} | |
- | |
name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- | |
name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: docker-pi-hole-base/. | |
platforms: ${{ matrix.job.PLATFORMS }} | |
build-args: | | |
DEBIAN_VERSION=${{ matrix.job.DEBIAN_VERSION }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |