You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Docker Image Update Checker
v1.2.0
Action to check if the base image was updated and your image (published on DockerHub) needs to be rebuilt. This action will use Docker's API to compare the base layers of your image with the base-image
, without the need to pull the images.
Name | Type | Description |
---|---|---|
base-image |
String | Base Docker Image |
image |
String | Your image based on base-image |
platforms |
String | Platforms to check |
Name | Type | Description |
---|---|---|
needs-updating |
String | 'true' or 'false' if the image needs to be updated or not |
Check if the image user/app:latest
, that has nginx
has a base image, needs to be updated:
name: Check docker image
on:
schedule:
- cron: '0 4 * * *'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check if update available
id: check
uses: lucacome/docker-image-update-checker@v1
with:
base-image: nginx:1.21.0
image: user/app:latest
- name: Check result
run: echo "Needs updating: ${{ steps.check.outputs.needs-updating }}"
Check if the image user/app:latest
, that has nginx
has a base image, needs to be updated:
name: Check docker image
on:
schedule:
- cron: '0 4 * * *'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check if update available
id: check
uses: lucacome/docker-image-update-checker@v1
with:
base-image: nginx:1.21.0
image: user/app:latest
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: user/app:latest
if: steps.check.outputs.needs-updating == 'true'
Note
The
platforms
input is optional and defaults tolinux/amd64
.
Check if the image user/app:latest
, that has nginx
has a base image, needs to be updated for linux/amd64
and linux/arm64
:
name: Check docker image for multiple platforms
on:
schedule:
- cron: '0 4 * * *'
jobs:
check:
runs-on: ubuntu-latest
outputs:
needs-updating: ${{ steps.check.outputs.needs-updating }}
steps:
- name: Check if update available
id: check
uses: lucacome/docker-image-update-checker@v1
with:
base-image: nginx:1.21.0
image: user/app:latest
platforms: linux/amd64,linux/arm64
build:
needs: check
runs-on: ubuntu-latest
if: needs.check.outputs.needs-updating == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: user/app:latest
platforms: linux/amd64,linux/arm64
Note
If any of the platforms is not present in either the base-image or the image, the action will exit with an error.