docker-nagios/.github/workflows/github-build.yml
2021-07-18 22:28:14 +03:00

68 lines
2.3 KiB
YAML

name: Nagios Build
# This workflow is triggered on pushes to the repository.
# Taken from tutorial
# https://github.com/gitschooldude/hello
# https://www.youtube.com/watch?v=-xIXFxuZCMI
# https://github.com/marketplace/actions/docker-setup-buildx
# https://github.com/marketplace/actions/docker-login
on: [push]
jobs:
nagios-build:
runs-on: ubuntu-latest
steps:
- name: Set the value of a custom my tag
id: step_one
run: |
echo "action_mytag=build-5-snapshot" >> $GITHUB_ENV
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
-
name: Cache Docker layers for this Git branch
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-${{ github.ref }}
-
name: Docker Buildx (build and cache)
run: |
docker buildx build \
--progress plain \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
--tag manios/nagios:${{ env.action_mytag }} \
--output "type=image,push=true" .
-
name: Docker Buildx (push)
run: |
echo "== This branch is : ${GITHUB_REF}"
docker buildx build \
--progress plain \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
--tag manios/nagios:${{ env.action_mytag }} \
--output "type=image,push=true" .
-
name: Inspect image
run: |
docker buildx imagetools inspect manios/nagios:${{ env.action_mytag }}