2021-11-16 07:19:27 +01:00
|
|
|
# This workflow is provided just as an example and not for repo testing/verification
|
2020-09-12 20:40:12 +02:00
|
|
|
name: example
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2021-11-16 07:19:27 +01:00
|
|
|
- cron: '0 10 * * 0'
|
2020-09-12 20:40:12 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
|
|
|
pull_request:
|
|
|
|
|
2020-10-28 19:40:11 +01:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
|
2020-09-12 20:40:12 +02:00
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 11:03:44 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
2020-10-28 19:40:11 +01:00
|
|
|
name: Docker meta
|
2021-03-29 14:33:52 +02:00
|
|
|
id: meta
|
2022-05-05 11:02:33 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2020-10-28 19:40:11 +01:00
|
|
|
with:
|
2021-03-29 14:33:52 +02:00
|
|
|
images: ${{ env.DOCKER_IMAGE }}
|
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-09-12 20:40:12 +02:00
|
|
|
with:
|
|
|
|
driver-opts: network=host
|
|
|
|
-
|
|
|
|
name: Build and export to Docker client
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
2020-10-28 19:40:11 +01:00
|
|
|
load: true
|
2021-03-29 14:33:52 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Build and push to local registry
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-03-29 14:33:52 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
run: |
|
2021-03-29 14:33:52 +02:00
|
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
|