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
79 lines (73 loc) · 2.37 KB
/
dockerimage.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
75
76
77
78
79
name: Build images for Docker Hub
on:
push:
branches:
- master
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
env:
REPO: "owasp/modsecurity"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
image: ["apache", "nginx"]
variant: ["", "-alpine"]
include:
- image: apache
modsec_version: "2.9.6"
- image: nginx
modsec_version: "3.0.8"
platform:
- linux/amd64
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: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.dockerhub_user }}
password: ${{ secrets.dockerhub_token }}
- 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 and push ${{ matrix.image }}${{ matrix.variant }} - ${{ matrix.modsec_version }}
uses: docker/bake-action@v2.2.0
with:
targets: ${{ matrix.image }}${{ matrix.variant }}
set: |
"${{ matrix.image }}${{ matrix.variant }}.args.MODSEC_VERSION=${{ matrix.modsec_version }}"
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
push: true