Skip to content

Workflow file for this run

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
tags:
- '*.*.*-*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- context: glpi-server/
file: glpi-server/Dockerfile
image: docker.io/ppcm/glpi-server
repository: ppcm/glpi-server
short-description: "GLPI web server with the UI"
- context: glpi-cron/
file: glpi-cron/Dockerfile
image: docker.io/ppcm/glpi-cron
repository: ppcm/glpi-cron
short-description: "GLPI cron job, you are in charge for the scheduling (start the job as you want)"
- context: glpi-cron-daemon/
file: glpi-cron-daemon/Dockerfile
image: docker.io/ppcm/glpi-cron-daemon
repository: ppcm/glpi-cron-daemon
short-description: "GLPI cron job daemon is running with scheduling managed"
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry docker.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ matrix.image }}
tags: |
type=match,pattern=\d+.\d+.\d+-\d+
type=match,pattern=(\d+.\d+.\d+)-\d+,group=1
type=match,pattern=(\d+.\d+).\d+-\d+,group=1
type=match,pattern=(\d+).\d+.\d+-\d+,group=1
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
file: ${{ matrix.file }}
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ matrix.repository }}
short-description: ${{ matrix.short-description }}
readme-filepath: ./README.md