-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
70 lines (58 loc) · 2.25 KB
/
test.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
name: Build mailcow Docker Images
on:
push:
branches: [ "master", "staging" ]
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
targets:
name: Generate targets list from provided bake file
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
#- name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepair Image Builds
run: |
cp -v helper-scripts/docker-compose.override.yml.d/BUILD_FLAGS/docker-compose.override.yml docker-compose.preride.yml
docker compose -f docker-compose.yml -f docker-compose.preride.yml config > docker-compose.override.yml
rm -v docker-compose.yml && mv -v docker-compose.override.yml docker-compose.yml
- name: Create matrix
id: targets
run: |
docker buildx bake ${{ inputs.group }} -f ${{ inputs.file }} --print
TARGETS=$(docker buildx bake ${{ inputs.group }} -f ${{ inputs.file }} --print | jq -cr ".group.${{ inputs.group }}.targets")
echo "matrix=$TARGETS" >> $GITHUB_OUTPUT
- name: Show matrix
run: |
echo ${{ steps.targets.outputs.matrix }}
needs:
- targets
# 2.0 - Build a matrix strategy from the retrieved target list
strategy:
fail-fast: true
matrix:
target: ${{ fromJson(needs.targets.outputs.matrix) }}
- name: Push Images using BuildX Bake
uses: docker/bake-action@v2
with:
files: |
./${{ inputs.file }}
${{ steps.meta.outputs.bake-file }}
targets: ${{ matrix.target }}
push: false
set: |
*.cache-from=type=gha,scope=build-${{ matrix.target }}
*.cache-to=type=gha,scope=build-${{ matrix.target }},mode=max
*.platform=linux/amd64,linux/arm64