-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (81 loc) · 2.42 KB
/
build.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
80
81
82
83
84
85
86
87
88
89
90
91
92
name: "Builder"
# Controls when the workflow will run
on:
push:
branches: ['main']
tags:
- 'v*.*.*'
pull_request:
branches: ['main']
schedule:
- cron: '18 6 */2 * *'
# Run builds at 06:18 on every 2nd day-of-month.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
snyk:
name: "Snyk: scanner"
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Build a Docker image
run: docker build -t moj/wordpress-base-fpm .
- name: Run Snyk | Check Docker image for vulnerabilities
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: moj/wordpress-base-fpm
args: --file=Dockerfile --severity-threshold=medium
build:
if: github.event_name != 'pull_request'
name: "Build: multi-arch docker"
needs: snyk
runs-on: ubuntu-latest
steps:
# First, checkout
- name: Checkout
uses: actions/checkout@v4
# QEMU; multi-arch stuff
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# get buildx - build multi-arch stuff
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# Access Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Gather meta for the builds
- name: Docker meta
id: wordpress-base-meta
uses: docker/metadata-action@v5
with:
images: ministryofjustice/wordpress-base-fpm
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
flavor: |
latest=true
# perform the builds
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: |
linux/amd64
linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.wordpress-base-meta.outputs.tags }}
labels: ${{ steps.wordpress-base-meta.outputs.labels }}