-
Notifications
You must be signed in to change notification settings - Fork 143
172 lines (162 loc) · 6.75 KB
/
build.yml
File metadata and controls
172 lines (162 loc) · 6.75 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build & Publish
permissions:
contents: read
on:
push:
branches:
- 'master'
paths-ignore:
- 'README.md'
- 'examples/**'
- 'apache-1.6.x/**'
- 'fpm-1.6.x/**'
- 'fpm-alpine-1.6.x/**'
- '.github/workflows/*-1.6.yml'
- 'development/**'
- 'nightly/**'
tags:
- '1.7.*'
schedule:
# Rebuild images each monday early morning to ensure a fresh base OS.
- cron: "23 2 * * 1"
workflow_dispatch:
jobs:
build-and-testvariants:
name: Build image variants and run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
include:
# The tags are pretty repetetive, but we can't properly script things using GitHub actions, and want to avoid scripting all the things manually, so we live with it.
- variant: 'apache'
test-files: 'apache-postgres'
docker-tag: |
roundcube/roundcubemail:1.7.x-apache
roundcube/roundcubemail:1.7.0-apache
roundcube/roundcubemail:latest-apache
roundcube/roundcubemail:latest
docker-tag-nonroot: |
roundcube/roundcubemail:1.7.x-apache-nonroot
roundcube/roundcubemail:1.7.0-apache-nonroot
roundcube/roundcubemail:latest-apache-nonroot
roundcube/roundcubemail:latest-nonroot
test-tag: roundcube/roundcubemail:latest-apache
test-tag-nonroot: roundcube/roundcubemail:latest-apache-nonroot
http-port-nonroot: '8000'
- variant: 'fpm'
test-files: 'fpm-postgres'
docker-tag: |
roundcube/roundcubemail:1.7.x-fpm
roundcube/roundcubemail:1.7.0-fpm
roundcube/roundcubemail:latest-fpm
docker-tag-nonroot: |
roundcube/roundcubemail:1.7.x-fpm-nonroot
roundcube/roundcubemail:1.7.0-fpm-nonroot
roundcube/roundcubemail:latest-fpm-nonroot
test-tag: roundcube/roundcubemail:latest-fpm
test-tag-nonroot: roundcube/roundcubemail:latest-fpm-nonroot
- variant: 'fpm-alpine'
test-files: 'fpm-postgres'
docker-tag: |
roundcube/roundcubemail:1.7.x-fpm-alpine
roundcube/roundcubemail:1.7.0-fpm-alpine
roundcube/roundcubemail:latest-fpm-alpine
docker-tag-nonroot: |
roundcube/roundcubemail:1.7.x-fpm-alpine-nonroot
roundcube/roundcubemail:1.7.0-fpm-alpine-nonroot
roundcube/roundcubemail:latest-fpm-alpine-nonroot
test-tag: roundcube/roundcubemail:latest-fpm-alpine
test-tag-nonroot: roundcube/roundcubemail:latest-fpm-alpine-nonroot
target: 'root'
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Docker
# This step is required to enable the containerd image store, which is required by the cache type=gha
uses: docker/setup-docker-action@efe9e3891a4f7307e689f2100b33a155b900a608 # v4.5.0
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
with:
buildkitd-flags: --debug
- name: Build rootful image to test for "${{ matrix.variant }}"
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: ${{ matrix.variant }}
load: true
tags: ${{ matrix.docker-tag }}
target: root
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test rootful image for "${{ matrix.variant }}"
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.test-tag }}
HTTP_PORT: '80'
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};
do
docker compose -f ./tests/docker-compose.test-${testFile}.yml down -v
docker compose -f ./tests/docker-compose.test-${testFile}.yml up --exit-code-from=sut --abort-on-container-exit
done
# Only log into docker now, so we benefit from the automatic caching of upstream images.
- name: Get docker hub username
id: creds
run: echo 'username=${{ secrets.DOCKER_PULL_USERNAME }}' >> $GITHUB_OUTPUT
- name: Login to Docker Hub
if: steps.creds.outputs.username != ''
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ secrets.DOCKER_PULL_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_PASSWORD }}
- name: Build and push rootful images for "${{ matrix.variant }} for all platforms"
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: ${{ matrix.variant }}
platforms: "linux/arm64,linux/arm/v6,linux/arm/v7,linux/386,linux/amd64,"
push: true
tags: ${{ matrix.docker-tag }}
target: root
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build nonroot image to test for "${{ matrix.variant }}"
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: ${{ matrix.variant }}
load: true
tags: ${{ matrix.docker-tag-nonroot }}
target: nonroot
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test nonroot image for "${{ matrix.variant }}"
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.test-tag-nonroot }}
HTTP_PORT: ${{ matrix.http-port-nonroot || '80' }}
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};
do
docker compose -f ./tests/docker-compose.test-${testFile}.yml down -v
docker compose -f ./tests/docker-compose.test-${testFile}.yml up --exit-code-from=sut --abort-on-container-exit
done
- name: Build and push nonroot images for "${{ matrix.variant }} for all platforms"
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: ${{ matrix.variant }}
platforms: "linux/arm64,linux/arm/v6,linux/arm/v7,linux/386,linux/amd64,"
push: true
tags: ${{ matrix.docker-tag-nonroot }}
target: nonroot
cache-from: type=gha
cache-to: type=gha,mode=max