Skip to content

Commit

Permalink
Update README for v1.2.0 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Jan 26, 2023
1 parent dfc5d71 commit 312448d
Showing 1 changed file with 103 additions and 10 deletions.
113 changes: 103 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Action to check if the base image was updated and your image (published on Docke
|---------------------|----------|------------------------------------|
| `base-image` | String | Base Docker Image |
| `image` | String | Your image based on `base-image` |
| `platforms` | String | Platforms to check |

## Output

Expand All @@ -22,10 +23,17 @@ Action to check if the base image was updated and your image (published on Docke
| `needs-updating`| String | 'true' or 'false' if the image needs to be updated or not |


## Example
## Examples
- [Minimal](#minimal)
- [Single platform](#single-platform)
- [Multiple platforms](#multiple-platforms)

### Minimal

Check if the image `user/app:latest`, that has `nginx` has a base image, needs to be updated:

```yaml
name: check docker images
name: Check docker image

on:
schedule:
Expand All @@ -35,22 +43,107 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Check if update available
- 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@v2

- name: Check result
run: echo "Needs updating: ${{ steps.check.outputs.needs-updating }}"

```


### Single platform

Check if the image `user/app:latest`, that has `nginx` has a base image, needs to be updated:

```yaml
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 to `linux/amd64`.

### Multiple platforms

Check if the image `user/app:latest`, that has `nginx` has a base image, needs to be updated for `linux/amd64` and `linux/arm64`:

```yaml
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.

0 comments on commit 312448d

Please sign in to comment.