Skip to content

Update Docker Images #1055

Update Docker Images

Update Docker Images #1055

name: Update Docker Images
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
variables:
name: Get version of base image
runs-on: ubuntu-24.04
outputs:
ubi_version: ${{ steps.version.outputs.ubi_version }}
nginx_version: ${{ steps.version.outputs.nginx_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Set Base image version
id: version
run: |
ubi=$(grep "FROM redhat/ubi9-minimal" < Dockerfile | awk -F" " '{print $2}')
nginx=$(grep -m1 "FROM nginx:" < Dockerfile | awk -F"[: ]" '{print $3}')
echo "ubi_version=${ubi}" >> $GITHUB_OUTPUT
echo "nginx_version=${nginx}" >> $GITHUB_OUTPUT
check:
name: Check if updates are needed
runs-on: ubuntu-24.04
needs: variables
steps:
- name: Check if update available
id: update
uses: lucacome/docker-image-update-checker@a233de0585661c019fb71f9601328db37051cc66 # v2.0.0
with:
base-image: ${{ needs.variables.outputs.ubi_version }}
image: nginxcontrib/nginx-ubi:${{ needs.variables.outputs.nginx_version }}
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: update
if: ${{ steps.update.outputs.needs-updating == 'true' }}