Update Docker Images #1037
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- 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@f50d56412b948cfdbb842c5419372681e0db3df1 # v1.2.1 | |
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' }} |