forked from coreruleset/modsecurity-crs-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 2.03 KB
/
Copy pathbuildimage.yml
File metadata and controls
63 lines (56 loc) · 2.03 KB
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
name: Build images for Docker Hub
on:
push:
branches:
- master
repository_dispatch:
types: [base-container-updated]
env:
REPO: "owasp/modsecurity-crs"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
crs_version: ["3.3.5"]
image: [apache, nginx]
variant: ["", "-alpine"]
steps:
- name: Checkout
uses: actions/checkout@v4
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.crs_version }}-${{ matrix.image }}${{ matrix.variant }}
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.crs_version }},suffix=${{ matrix.image }}${{ matrix.variant }}-{{date 'YYYYMMDDHHMM'}}
type=semver,pattern={{major}}.{{minor}},value=v${{ matrix.crs_version }},suffix=${{ matrix.image }}${{ matrix.variant }}-{{date 'YYYYMMDDHHMM'}}
type=semver,pattern={{version}},value=v${{ matrix.crs_version }},suffix=${{ matrix.image }}${{ matrix.variant }}-{{date 'YYYYMMDDHHMM'}}
- name: Build and push ${{ matrix.crs_version }}-${{ matrix.image }}${{ matrix.variant }}
uses: docker/bake-action@v2.3.0
with:
targets: ${{ matrix.image }}${{ matrix.variant }}
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
push: true