Skip to content

Commit 4b8d26a

Browse files
Sergey-Orlovandypost
authored andcommitted
Add Drupal 10 variant and improve build
1 parent 260038c commit 4b8d26a

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

drupal10/Dockerfile

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM alpine:3.20
22

3+
ARG PHP=php83
34
ARG BUILD_DATE
45
ARG VCS_REF
56

@@ -9,44 +10,42 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
910
org.label-schema.name="docker-phpcs-drupal" \
1011
org.label-schema.description="PHP codesniffer for Drupal - phpcs & phpcbf" \
1112
org.label-schema.vcs-url="https://github.com/skilld-labs/docker-phpcs-drupal" \
12-
maintainer="Andriy Yun , Andy Postnikov , Sergey Orlov"
13+
maintainer="Andriy Yun, Andy Postnikov, Sergey Orlov"
1314

1415
RUN set -e \
15-
&& apk add --no-cache \
16+
&& apk upgrade --update-cache -a && apk add \
1617
curl \
1718
git \
1819
patch \
19-
php83 \
20-
php83-apcu \
21-
php83-ctype \
22-
php83-json \
23-
php83-mbstring \
24-
php83-opcache \
25-
php83-openssl \
26-
php83-phar \
27-
php83-simplexml \
28-
php83-tokenizer \
29-
php83-xmlwriter \
30-
php83-zlib;
31-
32-
RUN ln -s $(which php8) /usr/local/bin/php \
20+
${PHP} \
21+
${PHP}-apcu \
22+
${PHP}-ctype \
23+
${PHP}-json \
24+
${PHP}-mbstring \
25+
${PHP}-opcache \
26+
${PHP}-openssl \
27+
${PHP}-phar \
28+
${PHP}-simplexml \
29+
${PHP}-tokenizer \
30+
${PHP}-xmlwriter \
31+
${PHP}-zip \
32+
&& rm -fr /var/cache/apk/* \
33+
&& ln -fs $(which ${PHP}) /usr/bin/php \
3334
&& curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/bin \
3435
&& composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true \
35-
&& composer global require drupal/coder --update-no-dev --no-suggest --prefer-dist ^8.3 \
36-
&& composer global require squizlabs/php_codesniffer \
36+
&& composer global require drupal/coder -o --apcu-autoloader --update-no-dev --no-suggest --prefer-dist ^8.3 \
3737
&& ln -s /root/.composer/vendor/bin/phpcs /usr/bin/phpcs \
3838
&& ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \
39-
# Clone coder sniffs into the codesniffer sniffs directory.
39+
# Link coder sniffs into the codesniffer sniffs directory.
4040
&& ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/Drupal \
4141
&& ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalPractice \
4242
# Removing packages which needed only during the installation.
43-
&& apk del --no-cache git \
43+
&& apk del --no-network --purge git \
4444
# Clear composer cache - it will just take space.
4545
&& rm -rf /root/.composer/cache/* \
46-
# Sniffs could take much time, we will set unlimited time for PHP execution
47-
&& sed -i "s/.*memory_limit = .*/memory_limit = -1/" /etc/php83/php.ini
46+
# Sniffs could take memory, set unlimited to be customized by end-user
47+
&& sed -i "s/.*memory_limit = .*/memory_limit = -1/" /etc/${PHP}/php.ini
4848

49-
VOLUME /work
5049
WORKDIR /work
5150

5251
CMD ["phpcs", "--standard=Drupal,DrupalPractice", "."]

0 commit comments

Comments
 (0)