mirror of
https://github.com/docker/build-push-action.git
synced 2024-12-25 16:22:12 -05:00
d3ddc4b4ef
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
# This workflow is provided just as an usage example and not for repo testing/verification
|
|
name: example
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 10 * * 0' # everyday sunday at 10am
|
|
push:
|
|
branches:
|
|
- '**'
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
|
|
env:
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
registry:
|
|
image: registry:2
|
|
ports:
|
|
- 5000:5000
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
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
|
|
-
|
|
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
|
|
load: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
-
|
|
name: Build and push to local registry
|
|
uses: ./
|
|
with:
|
|
context: ./test
|
|
file: ./test/Dockerfile
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
-
|
|
name: Inspect image
|
|
run: |
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
|
-
|
|
name: Check manifest
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
|
-
|
|
name: Dump context
|
|
if: always()
|
|
uses: crazy-max/ghaction-dump-context@v1
|