mirror of
https://github.com/klutchell/unbound-docker.git
synced 2026-10-14 00:02:38 +00:00
It should not be required for building, only for testing Signed-off-by: Kyle Harding <kyle@balena.io>
99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
name: docker
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
branches:
|
|
- "main"
|
|
|
|
env:
|
|
slug: "klutchell/unbound"
|
|
platforms: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
|
|
images: "docker.io/klutchell/unbound,ghcr.io/klutchell/unbound"
|
|
local_tag: localhost:5000/klutchell/unbound:latest
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
|
|
services:
|
|
registry:
|
|
image: registry:2.7.1
|
|
ports:
|
|
- 5000:5000
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ${{ env.images }}
|
|
tags: |
|
|
type=ref,event=tag
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=sha
|
|
|
|
- uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- uses: docker/build-push-action@v2
|
|
with:
|
|
platforms: ${{ env.platforms }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: ${{ env.local_tag }}
|
|
cache-to: type=gha,mode=max
|
|
cache-from: |
|
|
type=gha
|
|
${{ steps.meta.outputs.tags }}
|
|
docker.io/${{ env.slug }}:latest
|
|
ghcr.io/${{ env.slug }}:latest
|
|
push: true
|
|
|
|
- uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Test functionality
|
|
run: |
|
|
for platform in $(tr ',' '\n' <<< "${{ env.platforms }}") ; do
|
|
docker pull --platform ${platform} ${{ env.local_tag }}
|
|
docker run --rm ${{ env.local_tag }} -V | tee /dev/stderr | grep -wq "$(head -n1 VERSION)"
|
|
docker run -d --name sut ${{ env.local_tag }}
|
|
sleep 5
|
|
docker exec sut dig sigok.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -wq NOERROR || { docker logs sut ; exit 1 ; }
|
|
docker exec sut dig sigfail.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -wq SERVFAIL || { docker logs sut ; exit 1 ; }
|
|
docker logs sut
|
|
docker rm -f sut
|
|
done
|
|
|
|
- uses: docker/login-action@v1
|
|
if: github.actor == github.repository_owner
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: docker/login-action@v1
|
|
if: github.actor == github.repository_owner
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- uses: akhilerm/tag-push-action@v2.0.0
|
|
if: github.actor == github.repository_owner
|
|
with:
|
|
src: ${{ env.local_tag }}
|
|
dst: |
|
|
${{ steps.meta.outputs.tags }}
|
|
|
|
- uses: peter-evans/dockerhub-description@v2
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
repository: ${{ env.slug }}
|