This action checks using the DockerHub API if your image
, which is based on
a documented base-image
, needs to be rebuilt to use the most recent version of
your base-image
.
This example shows a check for user/app:latest
against an updated nginx
base image for the linux/amd64
architecture.
name: Check docker image for update
on:
schedule:
- cron: '0 4 * * *'
jobs:
docker-update-check:
runs-on: ubuntu-latest
steps:
- uses: KineticCafe/docker-image-update-checker@v1
id: check
with:
base-image: nginx:1.21.0
image: user/app:latest
- uses: actions/checkout@v4
if: steps.check.outputs.needs-update == 'true'
- uses: docker/[email protected]
with:
context: .
push: true
tags: user/app:latest
if: steps.check.outputs.needs-update == 'true'
This example shows a check for user/app:latest
against an updated nginx
base image for both linux/amd64
and linux/arm64
. The needs-update
flag is
set if any one of the platform abase images requires update.
name: Check docker image for update (multiple platforms)
on:
schedule:
- cron: '0 4 * * *'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: KineticCafe/docker-image-update-checker@v1
id: check
with:
base-image: nginx:1.21.0
image: user/app:latest
platform: linux/amd64,linux/arm64
build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.needs-updating == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/[email protected]
- uses: docker/[email protected]
- uses: docker/[email protected]
with:
context: .
push: true
tags: user/app:latest
platforms: |
linux/amd64
linux/arm64
image
: The target docker image for comparison.base-image
: The base docker image to compare against.platforms
: Image platforms to check. Defaults tolinux/amd64
. If any of the platforms are not present in eitherimage
orbase-image
, this action will exit with an error.
needs-output
: Returnstrue
if theimage
needs to be updated because thebase-imge
has received an update.
To debug this action, set the DEBUG
environment variable in the workflow file.
For convenience, DEBUG
can be set from ${{ secrets.ACTIONS_STEP_DEBUG }}
,
which works even when re-running the action with the Re-run job
button and
Enable debug logging
. To read more about debugging actions, see Debugging
actions.
@KineticCafe/docker-image-update-checker welcomes contributions. This project, like all Kinetic Commerce open source projects, is under the Kinetic Commerce Open Source Code of Conduct.
This project is licensed under the MIT license and requires certification via a Developer Certificate of Origin. See Licence.md for more details.
Releases are prepared with @vercel/ncc
to produce a single file which must
be committed to dist/
. Run pnpm package
or pnpm all
to produce this
file.