Skip to content

Publish Docker image #52

Publish Docker image

Publish Docker image #52

name: Publish Docker image
on:
push:
branches: '**'
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: debian-mate:bookworm
file: debian-mate/bookworm/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-mate:bookworm, nggit/debian-mate:latest
- name: debian-mate:bullseye
file: debian-mate/bullseye/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-mate:bullseye
- name: debian-mate:buster
file: debian-mate/buster/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-mate:buster
- name: debian-jwm:bookworm
file: debian-jwm/bookworm/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-jwm:bookworm, nggit/debian-jwm:latest
- name: debian-jwm:bullseye
file: debian-jwm/bullseye/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-jwm:bullseye
- name: debian-jwm:buster
file: debian-jwm/buster/Dockerfile
platforms: linux/amd64, linux/arm64
tags: nggit/debian-jwm:buster
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: List modified files
run: echo "FILES_MODIFIED=$( git diff --name-only HEAD HEAD^ )" >> $GITHUB_ENV
- name: Set up QEMU
if: ${{ contains(env.FILES_MODIFIED, '/Dockerfile') || github.event_name == 'schedule' }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ contains(env.FILES_MODIFIED, '/Dockerfile') || github.event_name == 'schedule' }}
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
if: ${{ contains(env.FILES_MODIFIED, '/Dockerfile') || github.event_name == 'schedule' }}
uses: docker/login-action@v2
with:
username: nggit
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push nggit/${{ matrix.name }}
if: ${{ contains(env.FILES_MODIFIED, matrix.file) || github.event_name == 'schedule' }}
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.file }}
push: true
tags: ${{ matrix.tags }}
platforms: ${{ matrix.platforms }}