This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
74 lines (66 loc) · 2.75 KB
/
dispatcher.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Test all platforms
on:
workflow_dispatch:
env:
REPO: "owasp/modsecurity"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
image: ["apache", "nginx"]
variant: ["", "-alpine"]
platform: ["linux/amd64", "linux/arm64/v8", "linux/arm/v7", "linux/i386"]
include:
- image: apache
modsec_version: "2.9.6"
- image: nginx
modsec_version: "3.0.8"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:master
- name: Docker meta ${{ matrix.image }}${{ matrix.variant }} - ${{ matrix.modsec_version }}
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.REPO }}
flavor: |
latest=false
tags: |
type=raw,value=${{ matrix.image }}${{ matrix.variant }}
type=semver,pattern={{major}},value=v${{ matrix.modsec_version }},suffix=-{{date 'YYYYMMDDHHMM'}}
type=semver,pattern={{major}}.{{minor}},value=v${{ matrix.modsec_version }},suffix=-{{date 'YYYYMMDDHHMM'}}
type=semver,pattern={{version}},value=v${{ matrix.modsec_version }},suffix=-{{date 'YYYYMMDDHHMM'}}
- name: Build ${{ matrix.image }}${{ matrix.variant }} - ${{ matrix.platform }}
uses: docker/[email protected]
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: ${{ matrix.image }}${{ matrix.variant }}
set: |
"${{ matrix.image }}${{ matrix.variant }}.platform=${{ matrix.platform }}"
"${{ matrix.image }}${{ matrix.variant }}.args.MODSEC_VERSION=${{ matrix.modsec_version }}"
pull: true
load: true
- name: Run ${{ matrix.image }}${{ matrix.variant }}
run: |
TAG=$(docker image inspect -f '{{ json .RepoTags }}' ${{ env.REPO }}:${{ matrix.image }}${{ matrix.variant }} | jq -r '.[0]')
echo "Starting container with TAG=$TAG"
docker run --pull "never" -d --name ${{ matrix.image }}${{ matrix.variant }}-test "$TAG"
docker logs ${{ matrix.image }}${{ matrix.variant }}-test
- name: Verify ${{ matrix.image }}${{ matrix.variant }}
run: |
docker logs "${{ matrix.image }}${{ matrix.variant }}-test"
[ $(docker inspect ${{ matrix.image }}${{ matrix.variant }}-test --format='{{.State.Running}}') = 'true' ]