Skip to content

Update Docker Images #941

Update Docker Images

Update Docker Images #941

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-20.04
outputs:
ubi_version: ${{ steps.version.outputs.ubi_version }}
nginx_version: ${{ steps.version.outputs.nginx_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- 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-20.04
needs: variables
steps:
- name: Check if update available
id: update
uses: lucacome/docker-image-update-checker@v1
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@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: update
if: ${{ steps.update.outputs.needs-updating == 'true' }}