mirror of
https://github.com/klutchell/unbound-docker.git
synced 2026-10-20 00:03:06 +00:00
113 lines
3.1 KiB
YAML
113 lines
3.1 KiB
YAML
name: docker
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
branches:
|
|
- "main"
|
|
|
|
env:
|
|
version: "1.13.1"
|
|
platforms: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
|
|
images: "docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}"
|
|
|
|
jobs:
|
|
|
|
docker-meta:
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
version: ${{ steps.meta.outputs.version }}
|
|
json: ${{ steps.meta.outputs.json }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ${{ env.images }}
|
|
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
needs: docker-meta
|
|
|
|
steps:
|
|
- name: Free disk space
|
|
run: |
|
|
df --human-readable
|
|
sudo apt clean
|
|
docker rmi $(docker image ls --all --quiet) || true
|
|
rm -rf "${AGENT_TOOLSDIRECTORY}"
|
|
df --human-readable
|
|
|
|
- name: Login to ghcr.io
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to docker.io
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- uses: docker/setup-qemu-action@v1
|
|
|
|
- uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- uses: docker/build-push-action@v2
|
|
with:
|
|
platforms: ${{ env.platforms }}
|
|
labels: ${{ needs.docker-meta.outputs.labels }}
|
|
tags: ${{ needs.docker-meta.outputs.tags }}
|
|
push: true
|
|
cache-to: type=gha,mode=max
|
|
cache-from: |
|
|
type=gha
|
|
${{ needs.docker-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: ${{ github.repository }}
|
|
|
|
test:
|
|
runs-on: ubuntu-20.04
|
|
needs: [docker-meta,build]
|
|
|
|
strategy:
|
|
matrix:
|
|
tag: ${{ fromJson(needs.docker-meta.outputs.json).tags }}
|
|
platform: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6]
|
|
|
|
steps:
|
|
- uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Pull ${{ matrix.platform }} manifest
|
|
run: |
|
|
docker pull --platform ${{ matrix.platform }} ${{ matrix.tag }}
|
|
|
|
- name: Check version
|
|
run: |
|
|
docker run ${{ matrix.tag }} -V | tee /dev/stderr | grep -wq ${{ env.version }}
|
|
|
|
- name: Check functionality
|
|
run: |
|
|
docker run -d --name sut ${{ matrix.tag }}
|
|
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
|