-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
337 lines (310 loc) · 10 KB
/
Dockerfile
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
ARG NODE_MAJOR=20
# Aliasing base images, so we can change just this, when needing to upgrade or pull base layers
FROM ubuntu:22.04 AS base-distro
FROM composer:2.8.2 AS composer
FROM base-distro AS install-markdownlint
ARG NODE_MAJOR
ENV NODE_MAJOR=$NODE_MAJOR
# Install system dependencies first - these don't change much
RUN set -eux; \
export DEBIAN_FRONTEND=noninteractive \
&& apt update \
&& apt install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt update \
&& apt install -y --no-install-recommends \
nodejs \
&& apt clean
COPY setup/markdownlint/package.json \
setup/markdownlint/package-lock.json \
setup/markdownlint/markdownlint.json \
/markdownlint/
COPY setup/markdownlint/dummy-ok-markdown-test-file.md \
setup/markdownlint/dummy-ko-markdown-test-file.md \
/test-files/
RUN cd /markdownlint \
&& npm ci \
# Smoke-testing the installation, just making sure it works as expected - should pass first file, fail on second
&& node_modules/.bin/markdownlint-cli2 /test-files/dummy-ok-markdown-test-file.md \
&& if node_modules/.bin/markdownlint-cli2 /test-files/dummy-ko-markdown-test-file.md; then exit 1; else exit 0; fi
FROM base-distro
ARG NODE_MAJOR
LABEL "repository"="http://github.com/laminas/laminas-continuous-integration-action"
LABEL "homepage"="http://github.com/laminas/laminas-continuous-integration-action"
LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/"
ENV COMPOSER_HOME=/usr/local/share/composer \
DEBIAN_FRONTEND=noninteractive \
ACCEPT_EULA=Y \
NODE_MAJOR=$NODE_MAJOR
# This may look a bit long, but it's just a big `apt install` section, followed by a cleanup,
# so that we get a single compact layer, with not too many layer overwrites.
RUN set -eux; \
export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \
&& apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
curl \
gpg-agent \
software-properties-common \
ca-certificates \
gnupg \
&& (curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg) \
&& add-apt-repository -y ppa:ondrej/php \
&& curl -sSL https://packages.microsoft.com/config/ubuntu/$OS_VERSION/prod.list | tee /etc/apt/sources.list.d/microsoft.list \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt update \
&& apt install -y --no-install-recommends \
# Base dependencies
git \
nodejs \
jq \
libxml2-utils \
libzip-dev \
make \
nodejs \
sudo \
wget \
yamllint \
zip \
unzip \
msodbcsql18 \
\
php-pear \
\
php5.6-bcmath \
php5.6-bz2 \
php5.6-cli \
php5.6-curl \
php5.6-dev \
php5.6-fileinfo \
php5.6-intl \
php5.6-json \
php5.6-mbstring \
php5.6-phar \
php5.6-phpdbg \
php5.6-readline \
php5.6-sockets \
php5.6-xml \
php5.6-xsl \
php5.6-zip \
\
php7.0-cli \
php7.0-bcmath \
php7.0-bz2 \
php7.0-curl \
php7.0-dev \
php7.0-fileinfo \
php7.0-intl \
php7.0-json \
php7.0-mbstring \
php7.0-phar \
php7.0-phpdbg \
php7.0-readline \
php7.0-sockets \
php7.0-xml \
php7.0-xsl \
php7.0-zip \
\
php7.1-cli \
php7.1-bcmath \
php7.1-bz2 \
php7.1-curl \
php7.1-dev \
php7.1-fileinfo \
php7.1-intl \
php7.1-json \
php7.1-mbstring \
php7.1-phar \
php7.1-phpdbg \
php7.1-readline \
php7.1-sockets \
php7.1-xml \
php7.1-xsl \
php7.1-zip \
\
php7.2-cli \
php7.2-bcmath \
php7.2-bz2 \
php7.2-curl \
php7.2-dev \
php7.2-fileinfo \
php7.2-intl \
php7.2-json \
php7.2-mbstring \
php7.2-phar \
php7.2-phpdbg \
php7.2-readline \
php7.2-sockets \
php7.2-xml \
php7.2-xsl \
php7.2-zip \
\
php7.3-cli \
php7.3-bcmath \
php7.3-bz2 \
php7.3-curl \
php7.3-dev \
php7.3-fileinfo \
php7.3-intl \
php7.3-json \
php7.3-mbstring \
php7.3-phar \
php7.3-phpdbg \
php7.3-readline \
php7.3-sockets \
php7.3-xml \
php7.3-xsl \
php7.3-zip \
\
php7.4-cli \
php7.4-bcmath \
php7.4-bz2 \
php7.4-curl \
php7.4-dev \
php7.4-fileinfo \
php7.4-intl \
php7.4-json \
php7.4-mbstring \
php7.4-phar \
php7.4-phpdbg \
php7.4-readline \
php7.4-sockets \
php7.4-xml \
php7.4-xsl \
php7.4-zip \
\
php8.0-cli \
php8.0-bcmath \
php8.0-bz2 \
php8.0-curl \
php8.0-dev \
php8.0-fileinfo \
php8.0-intl \
php8.0-mbstring \
php8.0-phar \
php8.0-phpdbg \
php8.0-readline \
php8.0-sockets \
php8.0-xml \
php8.0-xsl \
php8.0-zip \
\
php8.1-cli \
php8.1-bcmath \
php8.1-bz2 \
php8.1-curl \
php8.1-dev \
php8.1-fileinfo \
php8.1-intl \
php8.1-mbstring \
php8.1-phar \
php8.1-phpdbg \
php8.1-readline \
php8.1-sockets \
php8.1-xml \
php8.1-xsl \
php8.1-zip \
\
php8.2-cli \
php8.2-bcmath \
php8.2-bz2 \
php8.2-curl \
php8.2-dev \
php8.2-fileinfo \
php8.2-intl \
php8.2-mbstring \
php8.2-phar \
php8.2-phpdbg \
php8.2-readline \
php8.2-sockets \
php8.2-xml \
php8.2-xsl \
php8.2-zip \
\
php8.3-cli \
php8.3-bcmath \
php8.3-bz2 \
php8.3-curl \
php8.3-dev \
php8.3-fileinfo \
php8.3-intl \
php8.3-mbstring \
php8.3-phar \
php8.3-phpdbg \
php8.3-readline \
php8.3-sockets \
php8.3-xml \
php8.3-xsl \
php8.3-zip \
\
php8.4-cli \
php8.4-bcmath \
php8.4-bz2 \
php8.4-curl \
php8.4-dev \
php8.4-fileinfo \
php8.4-intl \
php8.4-mbstring \
php8.4-phar \
php8.4-phpdbg \
php8.4-readline \
php8.4-sockets \
php8.4-xml \
php8.4-xsl \
php8.4-zip \
&& apt autoremove -y \
&& apt clean
# Build/install static modules that do not have packages
COPY mods-available /mods-available
COPY mods-install /mods-install
RUN set -e; for INSTALLER in /mods-install/*.sh; do ${INSTALLER} ; done
COPY scripts /scripts
RUN chmod a+x /scripts/*
RUN /scripts/php_ini_dev_settings.sh
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY php-extensions-with-version.php /usr/local/bin/php-extensions-with-version.php
RUN chmod +x /usr/local/bin/php-extensions-with-version.php
# Copy Markdownlint installation to this stage
COPY --from=install-markdownlint /markdownlint /markdownlint
RUN ln -s /markdownlint/node_modules/.bin/markdownlint-cli2 /usr/local/bin/markdownlint
COPY --from=install-markdownlint /markdownlint/markdownlint.json /etc/laminas-ci/markdownlint.json
# Add composer binary to the image
COPY --from=composer /usr/bin/composer /usr/bin/composer
# We use https://github.com/xt0rted/markdownlint-problem-matcher/blob/caf6b376527f8a8ac3b8ed6746989e51a6e560c8/.github/problem-matcher.json
# and https://github.com/shivammathur/setup-php/blob/57db6baebbe30a3126c7a03aa0e3267fa7872d96/src/configs/pm/phpunit.json
# to match the output of Markdownlint and PHPUnit to GitHub Actions
# annotations (https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message)
COPY setup/markdownlint/problem-matcher.json /etc/laminas-ci/problem-matcher/markdownlint.json
COPY setup/phpunit/problem-matcher.json /etc/laminas-ci/problem-matcher/phpunit.json
# Setup external tools
COPY composer.json \
composer.lock \
/tools/
# Set default PHP version based on the `composer.json` `config.platform.php` setting
RUN set -eux; \
export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?<minor>[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \
&& update-alternatives --set php /usr/bin/php$DEFAULT_PHP_VERSION \
&& update-alternatives --set phpize /usr/bin/phpize$DEFAULT_PHP_VERSION \
&& update-alternatives --set php-config /usr/bin/php-config$DEFAULT_PHP_VERSION \
&& update-alternatives --set phpdbg /usr/bin/phpdbg$DEFAULT_PHP_VERSION \
&& echo "DEFAULT_PHP_VERSION=${DEFAULT_PHP_VERSION}" >> /etc/environment
RUN cd /tools \
&& composer install \
--classmap-authoritative \
# Cleanup composer files from external tools folder
&& rm /tools/composer.*
# Copy staabm/annotate-pull-request-from-checkstyle to external-tools stage
RUN ln -s /tools/vendor/bin/cs2pr /usr/local/bin/cs2pr
# Copy roave/backward-compatibility-check to this stage
RUN ln -s /tools/vendor/bin/roave-backward-compatibility-check /usr/local/bin/roave-backward-compatibility-check
RUN useradd -ms /bin/bash testuser
# Copy ubuntu setup
COPY setup/ubuntu /
ENTRYPOINT ["entrypoint.sh"]