mirror of
https://github.com/klutchell/unbound-docker.git
synced 2026-10-15 08:02:40 +00:00
136 lines
4.9 KiB
YAML
136 lines
4.9 KiB
YAML
name: default
|
|
|
|
on: push
|
|
|
|
env:
|
|
PACKAGE_VERSION: "1.13.1"
|
|
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
runs-on: ubuntu-20.04
|
|
services:
|
|
registry:
|
|
image: registry:2
|
|
ports:
|
|
- 5000:5000
|
|
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: Maximize build space
|
|
# uses: easimon/maximize-build-space@master
|
|
# with:
|
|
# remove-dotnet: 'true'
|
|
# remove-android: 'true'
|
|
# remove-haskell: 'true'
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Set vars
|
|
id: vars
|
|
run: |
|
|
echo "image_title=${{ github.repository }}" >> $GITHUB_ENV
|
|
echo "image_authors=${{ github.repository_owner }}" >> $GITHUB_ENV
|
|
echo "image_name=${{ github.repository }}" >> $GITHUB_ENV
|
|
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
|
|
echo "image_version=${{ env.PACKAGE_VERSION }}" >> $GITHUB_ENV
|
|
echo "image_revision=$(git describe --tags --always --dirty)" >> $GITHUB_ENV
|
|
echo "image_source=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
echo "image_url=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: network=host
|
|
-
|
|
name: Build and push to local registry
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
platforms: ${{ env.PLATFORMS }}
|
|
build-args: |
|
|
PACKAGE_VERSION=${{ env.PACKAGE_VERSION }}
|
|
tags: |
|
|
localhost:5000/${{ env.image_name }}:latest
|
|
labels: |
|
|
"org.opencontainers.image.authors=${{ env.image_authors }}"
|
|
"org.opencontainers.image.title=${{ env.image_title }}"
|
|
"org.opencontainers.image.created=${{ env.image_created }}"
|
|
"org.opencontainers.image.version=${{ env.image_version }}"
|
|
"org.opencontainers.image.revision=${{ env.image_revision }}"
|
|
"org.opencontainers.image.source=${{ env.image_source }}"
|
|
"org.opencontainers.image.url=${{ env.image_url }}"
|
|
cache-from: |
|
|
type=gha
|
|
type=registry,ref=ghcr.io/${{ env.image_name }}:latest
|
|
type=registry,ref=ghcr.io/${{ env.image_name }}:${{ env.PACKAGE_VERSION }}
|
|
type=registry,ref=docker.io/${{ env.image_name }}:latest
|
|
type=registry,ref=docker.io/${{ env.image_name }}:${{ env.PACKAGE_VERSION }}
|
|
cache-to: |
|
|
type=gha,mode=max
|
|
push: true
|
|
-
|
|
name: Inspect
|
|
run: |
|
|
docker buildx imagetools inspect localhost:5000/${{ env.image_name }}:latest
|
|
-
|
|
name: Test each platform
|
|
run: |
|
|
for platform in ${PLATFORMS//,/ }
|
|
do
|
|
docker pull --platform ${platform} localhost:5000/${{ env.image_name }}:latest
|
|
docker run --rm -d --name sut ${{ env.image_name }}:latest
|
|
docker exec sut dig sigok.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -q NOERROR
|
|
docker exec sut dig sigfail.verteiltesysteme.net @127.0.0.1 +dnssec | tee /dev/stderr | grep -q SERVFAIL
|
|
docker stop sut
|
|
done
|
|
-
|
|
name: Login to GitHub Container Registry
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Login to DockerHub
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
-
|
|
name: Push Image to multiple registries
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: akhilerm/tag-push-action@v1.1.0
|
|
with:
|
|
src: localhost:5000/${{ env.image_name }}:latest
|
|
dst: |
|
|
ghcr.io/${{ env.image_name }}:${{ env.PACKAGE_VERSION }}
|
|
ghcr.io/${{ env.image_name }}:latest
|
|
docker.io/${{ env.image_name }}:${{ env.PACKAGE_VERSION }}
|
|
docker.io/${{ env.image_name }}:latest
|
|
-
|
|
name: Set DockerHub description
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: peter-evans/dockerhub-description@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
repository: ${{ env.image_name }}
|