Skip to content

Update Docker Images #627

Update Docker Images

Update Docker Images #627

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@v3
- 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 "::set-output name=ubi_version::$ubi"
echo "::set-output name=nginx_version::$nginx"
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@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: update
if: ${{ steps.update.outputs.needs-updating == 'true' }}