2020-09-12 21:14:33 +02:00
|
|
|
# This workflow is provided just as an usage example and not for repo testing/verification
|
2020-09-12 20:40:12 +02:00
|
|
|
name: example
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 10 * * 0' # everyday sunday at 10am
|
|
|
|
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
|
2020-11-17 10:06:56 +01:00
|
|
|
uses: actions/checkout@v2
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
2020-10-28 19:40:11 +01:00
|
|
|
name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
|
|
with:
|
|
|
|
images: ${{ env.DOCKER_IMAGE }} # list of Docker images to use as base name for tags
|
|
|
|
tag-sha: true # add git short SHA as Docker tag
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
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
|
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_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' }}
|
2020-10-28 19:40:11 +01:00
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
run: |
|
2020-10-28 19:40:11 +01:00
|
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: |
|
2020-10-28 19:40:11 +01:00
|
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
2020-09-12 20:40:12 +02:00
|
|
|
-
|
|
|
|
name: Dump context
|
|
|
|
if: always()
|
|
|
|
uses: crazy-max/ghaction-dump-context@v1
|