forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.78 KB
/
build-docker-images-for-testing.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
name: "Build Docker Images For Testing"
on:
workflow_dispatch:
workflow_call:
jobs:
build:
# build with docker so we can use layer caching
name: Build Docker Images
runs-on: ubuntu-latest
strategy:
matrix:
docker-image: [django, nginx, integration-tests]
os: [alpine, debian]
exclude:
- docker-image: integration-tests
os: alpine
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Read Docker Image Identifiers
id: read-docker-image-identifiers
run: echo "IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
driver-opts: image=moby/buildkit:master # needed to get the fix for https://github.com/moby/buildkit/issues/2426
- name: Build
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
push: false
tags: defectdojo/defectdojo-${{ matrix.docker-image }}:${{ matrix.os }}
file: Dockerfile.${{ matrix.docker-image }}-${{ matrix.os }}
outputs: type=docker,dest=${{ matrix.docker-image }}-${{ matrix.os }}_img
cache-from: type=gha,scope=${{ matrix.docker-image }}
cache-to: type=gha,mode=max,scope=${{ matrix.docker-image }}
# export docker images to be used in next jobs below
- name: Upload image ${{ matrix.docker-image }} as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.docker-image }}
path: ${{ matrix.docker-image }}-${{ matrix.os }}_img
retention-days: 1