Skip to content

Manual Build & Push

Manual Build & Push #5

name: Manual Build & Push
on:
workflow_dispatch:
inputs:
imageTag:
description: 'Image Tag'
required: true
default: 'dev'
type: choice
options:
- dev
- latest
jobs:
job01:
name: Build and publish
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
ref: main
-
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
env:
IMAGE_TAG: ${{ inputs.imageTag }}
with:
images: |
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole-unbound
flavor: |
latest=false
tags: |
type=raw,value=${{ inputs.imageTag }}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
env:
IMAGE_TAG: ${{ inputs.imageTag }}
with:
context: ./
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6
build-args: BASE_IMG_TAG=${{ inputs.imageTag }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=registry,ref=${{ secrets.DOCKERHUB_NAMESPACE }}/pihole-unbound:buildcache.${{ inputs.imageTag }}
cache-to: |
type=registry,ref=${{ secrets.DOCKERHUB_NAMESPACE }}/pihole-unbound:buildcache.${{ inputs.imageTag }},mode=max