1
- FROM ubuntu:focal
1
+ # Aliasing base images, so we can change just this, when needing to upgrade or pull base layers
2
+ FROM ubuntu:20.04 AS base-distro
3
+ FROM composer:2.2.4 AS composer
2
4
3
- LABEL "repository" ="http://github.com/laminas/laminas-continuous-integration-action"
4
- LABEL "homepage" ="http://github.com/laminas/laminas-continuous-integration-action"
5
- LABEL "maintainer" ="https://github.com/laminas/technical-steering-committee/"
6
5
7
- ENV COMPOSER_HOME=/usr/local/share/composer
8
- ENV DEBIAN_FRONTEND=noninteractive
6
+ FROM base-distro AS install-markdownlint
7
+
8
+ # Install system dependencies first - these don't change much
9
+ RUN export DEBIAN_FRONTEND=noninteractive \
10
+ && apt update \
11
+ && apt install -y --no-install-recommends \
12
+ npm \
13
+ && apt clean
9
14
10
- COPY setup /setup
11
- # Base setup
12
- RUN cd /setup/ubuntu && bash setup.sh
15
+ COPY setup/markdownlint/package.json \
16
+ setup/markdownlint/package-lock.json \
17
+ setup/markdownlint/markdownlint.json \
18
+ /markdownlint/
13
19
14
- # Markdownlint
15
- RUN cd /setup/markdownlint && bash setup.sh
20
+ COPY setup/markdownlint/dummy-ok-markdown-test-file.md \
21
+ setup/markdownlint/dummy-ko-markdown-test-file.md \
22
+ /test-files/
16
23
17
- # PHP
18
- RUN cd /setup/php/5.6 && bash setup.sh
19
- RUN cd /setup/php/7.0 && bash setup.sh
20
- RUN cd /setup/php/7.1 && bash setup.sh
21
- RUN cd /setup/php/7.2 && bash setup.sh
22
- RUN cd /setup/php/7.3 && bash setup.sh
23
- RUN cd /setup/php/7.4 && bash setup.sh
24
- RUN cd /setup/php/8.0 && bash setup.sh
25
- RUN cd /setup/php/8.1 && bash setup.sh
24
+ RUN cd /markdownlint \
25
+ && npm ci \
26
+ # Smoke-testing the installation, just making sure it works as expected - should pass first file, fail on second
27
+ && node_modules/.bin/markdownlint-cli2 /test-files/dummy-ok-markdown-test-file.md \
28
+ && if node_modules/.bin/markdownlint-cli2 /test-files/dummy-ko-markdown-test-file.md; then exit 1; else exit 0; fi
26
29
27
- # Set default PHP version
28
- RUN update-alternatives --set php /usr/bin/php7.4 \
29
- && update-alternatives --set phpize /usr/bin/phpize7.4 \
30
- && update-alternatives --set php-config /usr/bin/php-config7.4
31
30
32
- # Cleanup
33
- RUN rm -rf /setup \
31
+ FROM composer AS staabm-annotate-pull-request-from-checkstyle
32
+
33
+ COPY setup/staabm-annotate-pull-request-from-checkstyle/composer.json \
34
+ setup/staabm-annotate-pull-request-from-checkstyle/composer.lock \
35
+ /staabm-annotate-pull-request-from-checkstyle/
36
+
37
+ RUN cd /staabm-annotate-pull-request-from-checkstyle \
38
+ && composer install \
39
+ --no-dev \
40
+ --classmap-authoritative
41
+
42
+
43
+ FROM base-distro
44
+
45
+ LABEL "repository" ="http://github.com/laminas/laminas-continuous-integration-action"
46
+ LABEL "homepage" ="http://github.com/laminas/laminas-continuous-integration-action"
47
+ LABEL "maintainer" ="https://github.com/laminas/technical-steering-committee/"
48
+
49
+ ENV COMPOSER_HOME=/usr/local/share/composer \
50
+ DEBIAN_FRONTEND=noninteractive \
51
+ ACCEPT_EULA=Y
52
+
53
+ # This may look a bit long, but it's just a big `apt install` section, followed by a cleanup,
54
+ # so that we get a single compact layer, with not too many layer overwrites.
55
+ RUN apt update \
56
+ && apt upgrade -y \
57
+ && apt install -y --no-install-recommends \
58
+ curl \
59
+ gpg-agent \
60
+ software-properties-common \
61
+ && (curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -) \
62
+ && add-apt-repository -y ppa:ondrej/php \
63
+ && add-apt-repository -y https://packages.microsoft.com/ubuntu/20.04/prod \
64
+ && apt install -y --no-install-recommends \
65
+ # Base dependencies
66
+ git \
67
+ jq \
68
+ libxml2-utils \
69
+ libzip-dev \
70
+ nodejs \
71
+ sudo \
72
+ wget \
73
+ yamllint \
74
+ zip \
75
+ msodbcsql17 \
76
+ \
77
+ php5.6-bz2 \
78
+ php5.6-cli \
79
+ php5.6-curl \
80
+ php5.6-dev \
81
+ php5.6-fileinfo \
82
+ php5.6-intl \
83
+ php5.6-json \
84
+ php5.6-mbstring \
85
+ php5.6-phar \
86
+ php5.6-phpdbg \
87
+ php5.6-readline \
88
+ php5.6-sockets \
89
+ php5.6-xml \
90
+ php5.6-xsl \
91
+ php5.6-zip \
92
+ \
93
+ php7.0-cli \
94
+ php7.0-bz2 \
95
+ php7.0-curl \
96
+ php7.0-dev \
97
+ php7.0-fileinfo \
98
+ php7.0-intl \
99
+ php7.0-json \
100
+ php7.0-mbstring \
101
+ php7.0-phar \
102
+ php7.0-phpdbg \
103
+ php7.0-readline \
104
+ php7.0-sockets \
105
+ php7.0-xml \
106
+ php7.0-xsl \
107
+ php7.0-zip \
108
+ \
109
+ php7.1-cli \
110
+ php7.1-bz2 \
111
+ php7.1-curl \
112
+ php7.1-dev \
113
+ php7.1-fileinfo \
114
+ php7.1-intl \
115
+ php7.1-json \
116
+ php7.1-mbstring \
117
+ php7.1-phar \
118
+ php7.1-phpdbg \
119
+ php7.1-readline \
120
+ php7.1-sockets \
121
+ php7.1-xml \
122
+ php7.1-xsl \
123
+ php7.1-zip \
124
+ \
125
+ php7.2-cli \
126
+ php7.2-bz2 \
127
+ php7.2-curl \
128
+ php7.2-dev \
129
+ php7.2-fileinfo \
130
+ php7.2-intl \
131
+ php7.2-json \
132
+ php7.2-mbstring \
133
+ php7.2-phar \
134
+ php7.2-phpdbg \
135
+ php7.2-readline \
136
+ php7.2-sockets \
137
+ php7.2-xml \
138
+ php7.2-xsl \
139
+ php7.2-zip \
140
+ \
141
+ php7.3-cli \
142
+ php7.3-bz2 \
143
+ php7.3-curl \
144
+ php7.3-dev \
145
+ php7.3-fileinfo \
146
+ php7.3-intl \
147
+ php7.3-json \
148
+ php7.3-mbstring \
149
+ php7.3-phar \
150
+ php7.3-phpdbg \
151
+ php7.3-readline \
152
+ php7.3-sockets \
153
+ php7.3-xml \
154
+ php7.3-xsl \
155
+ php7.3-zip \
156
+ \
157
+ php7.4-cli \
158
+ php7.4-bz2 \
159
+ php7.4-curl \
160
+ php7.4-dev \
161
+ php7.4-fileinfo \
162
+ php7.4-intl \
163
+ php7.4-json \
164
+ php7.4-mbstring \
165
+ php7.4-phar \
166
+ php7.4-phpdbg \
167
+ php7.4-readline \
168
+ php7.4-sockets \
169
+ php7.4-xml \
170
+ php7.4-xsl \
171
+ php7.4-zip \
172
+ \
173
+ php8.0-cli \
174
+ php8.0-bz2 \
175
+ php8.0-curl \
176
+ php8.0-dev \
177
+ php8.0-fileinfo \
178
+ php8.0-intl \
179
+ php8.0-mbstring \
180
+ php8.0-phar \
181
+ php8.0-phpdbg \
182
+ php8.0-readline \
183
+ php8.0-sockets \
184
+ php8.0-xml \
185
+ php8.0-xsl \
186
+ php8.0-zip \
187
+ \
188
+ php8.1-cli \
189
+ php8.1-bz2 \
190
+ php8.1-curl \
191
+ php8.1-dev \
192
+ php8.1-fileinfo \
193
+ php8.1-intl \
194
+ php8.1-mbstring \
195
+ php8.1-phar \
196
+ php8.1-phpdbg \
197
+ php8.1-readline \
198
+ php8.1-sockets \
199
+ php8.1-xml \
200
+ php8.1-xsl \
201
+ php8.1-zip \
202
+ # Set default PHP version
203
+ && update-alternatives --set php /usr/bin/php7.4 \
204
+ && update-alternatives --set phpize /usr/bin/phpize7.4 \
205
+ && update-alternatives --set php-config /usr/bin/php-config7.4 \
206
+ && apt autoremove -y \
34
207
&& apt clean
35
208
209
+
36
210
# Build/install static modules that do not have packages
37
211
COPY mods-available /mods-available
38
212
COPY mods-install /mods-install
39
213
RUN for INSTALLER in /mods-install/*.sh;do ${INSTALLER} ; done
40
214
41
- RUN mkdir -p /etc/laminas-ci/problem-matcher \
42
- && cd /etc/laminas-ci/problem-matcher \
43
- && wget https://raw.githubusercontent.com/shivammathur/setup-php/master/src/configs/pm/phpunit.json \
44
- && wget -O markdownlint.json https://raw.githubusercontent.com/xt0rted/markdownlint-problem-matcher/main/.github/problem-matcher.json
45
-
46
- COPY etc/markdownlint.json /etc/laminas-ci/markdownlint.json
47
-
48
- COPY --from=composer:2.2.4 /usr/bin/composer /usr/bin/composer
49
-
50
- RUN mkdir -p /usr/local/share/composer \
51
- && composer global require staabm/annotate-pull-request-from-checkstyle \
52
- && ln -s /usr/local/share/composer/vendor/bin/cs2pr /usr/local/bin/cs2pr
53
-
54
215
COPY scripts /scripts
55
216
RUN chmod a+x /scripts/*
56
217
@@ -59,6 +220,29 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
59
220
COPY php-extensions-with-version.php /usr/local/bin/php-extensions-with-version.php
60
221
RUN chmod +x /usr/local/bin/php-extensions-with-version.php
61
222
223
+ # Copy Markdownlint installation to this stage
224
+ COPY --from=install-markdownlint /markdownlint /markdownlint
225
+ RUN ln -s /markdownlint/node_modules/.bin/markdownlint-cli2 /usr/local/bin/markdownlint
226
+ COPY --from=install-markdownlint /markdownlint/markdownlint.json /etc/markdownlint.json
227
+
228
+
229
+ # Copy staabm/annotate-pull-request-from-checkstyle to this stage
230
+ COPY --from=staabm-annotate-pull-request-from-checkstyle /staabm-annotate-pull-request-from-checkstyle /staabm-annotate-pull-request-from-checkstyle
231
+ RUN ln -s /staabm-annotate-pull-request-from-checkstyle/vendor/bin/cs2pr /usr/local/bin/cs2pr
232
+
233
+
234
+ # Add composer binary to the image
235
+ COPY --from=composer /usr/bin/composer /usr/bin/composer
236
+
237
+
238
+ # We use https://github.com/xt0rted/markdownlint-problem-matcher/blob/caf6b376527f8a8ac3b8ed6746989e51a6e560c8/.github/problem-matcher.json
239
+ # and https://github.com/shivammathur/setup-php/blob/57db6baebbe30a3126c7a03aa0e3267fa7872d96/src/configs/pm/phpunit.json
240
+ # to match the output of Markdownlint and PHPUnit to GitHub Actions
241
+ # annotations (https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message)
242
+ COPY setup/markdownlint/problem-matcher.json /etc/laminas-ci/problem-matcher/markdownlint.json
243
+ COPY setup/phpunit/problem-matcher.json /etc/laminas-ci/problem-matcher/phpunit.json
244
+
245
+
62
246
RUN useradd -ms /bin/bash testuser
63
247
64
248
ENTRYPOINT ["entrypoint.sh" ]
0 commit comments