From 7ada3450f3f964e10ee62b689ed10e2721339e0d Mon Sep 17 00:00:00 2001 From: Yaroslav Lushnikov Date: Thu, 27 Jan 2022 17:16:39 +0700 Subject: [PATCH 1/5] Update version of Coder Update coder module version and remove non-relevant patch from the build --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8abf067..9d2c72e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,12 +29,11 @@ RUN set -e \ php7-xmlwriter \ php7-zlib \ && curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/bin \ - && composer global require drupal/coder --update-no-dev --no-suggest --prefer-dist ^8.2 \ + && composer global require drupal/coder --update-no-dev --no-suggest --prefer-dist ^8.3 \ && ln -s /root/.composer/vendor/bin/phpcs /usr/bin/phpcs \ && ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Drupal \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/DrupalPractice \ - && cd /root/.composer/vendor/drupal/coder && curl https://www.drupal.org/files/issues/2857856-8.patch | patch -p1 && cd \ && git clone --branch master https://git.drupal.org/sandbox/coltrane/1921926.git /root/drupalsecure_code_sniffs \ && rm -rf /root/drupalsecure_code_sniffs/.git \ && cd /root/drupalsecure_code_sniffs && curl https://www.drupal.org/files/issues/parenthesis_closer_notice-2320623-2.patch | git apply && cd \ From dd67e9b5f105d16c2520a25fc43a7a30095a9efb Mon Sep 17 00:00:00 2001 From: Yaroslav Lushnikov Date: Thu, 27 Jan 2022 17:27:10 +0700 Subject: [PATCH 2/5] Update path to the standards --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d2c72e..f18a45c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,14 +32,14 @@ RUN set -e \ && composer global require drupal/coder --update-no-dev --no-suggest --prefer-dist ^8.3 \ && ln -s /root/.composer/vendor/bin/phpcs /usr/bin/phpcs \ && ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \ - && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Drupal \ - && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/DrupalPractice \ + && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/Drupal \ + && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalPractice \ && git clone --branch master https://git.drupal.org/sandbox/coltrane/1921926.git /root/drupalsecure_code_sniffs \ && rm -rf /root/drupalsecure_code_sniffs/.git \ && cd /root/drupalsecure_code_sniffs && curl https://www.drupal.org/files/issues/parenthesis_closer_notice-2320623-2.patch | git apply && cd \ && apk del --no-cache git \ && rm -rf /root/.composer/cache/* \ - && ln -s /root/drupalsecure_code_sniffs/DrupalSecure /root/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/DrupalSecure \ + && ln -s /root/drupalsecure_code_sniffs/DrupalSecure /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalSecure \ && sed -i "s/.*memory_limit = .*/memory_limit = -1/" /etc/php7/php.ini VOLUME /work From 59427fe0732440da9f5665255f792eaa31283535 Mon Sep 17 00:00:00 2001 From: Yaroslav Lushnikov Date: Thu, 27 Jan 2022 17:31:28 +0700 Subject: [PATCH 3/5] Update path to the repository with the security sniffs --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f18a45c..3f5363a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,7 @@ RUN set -e \ && ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/Drupal \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalPractice \ - && git clone --branch master https://git.drupal.org/sandbox/coltrane/1921926.git /root/drupalsecure_code_sniffs \ + && git clone --branch master https://git.drupalcode.org/sandbox/coltrane-1921926.git /root/drupalsecure_code_sniffs \ && rm -rf /root/drupalsecure_code_sniffs/.git \ && cd /root/drupalsecure_code_sniffs && curl https://www.drupal.org/files/issues/parenthesis_closer_notice-2320623-2.patch | git apply && cd \ && apk del --no-cache git \ From 6c5df50d60e23cc3e65fa6575d0813deffc84380 Mon Sep 17 00:00:00 2001 From: Yaroslav Lushnikov Date: Thu, 27 Jan 2022 17:38:02 +0700 Subject: [PATCH 4/5] Remove drupal secure --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3f5363a..312fcbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,9 +34,6 @@ RUN set -e \ && ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/Drupal \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalPractice \ - && git clone --branch master https://git.drupalcode.org/sandbox/coltrane-1921926.git /root/drupalsecure_code_sniffs \ - && rm -rf /root/drupalsecure_code_sniffs/.git \ - && cd /root/drupalsecure_code_sniffs && curl https://www.drupal.org/files/issues/parenthesis_closer_notice-2320623-2.patch | git apply && cd \ && apk del --no-cache git \ && rm -rf /root/.composer/cache/* \ && ln -s /root/drupalsecure_code_sniffs/DrupalSecure /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalSecure \ From fc101b8d6507fdf9ef0cc58f87cbeccb10d82938 Mon Sep 17 00:00:00 2001 From: Yaroslav Lushnikov Date: Mon, 31 Jan 2022 10:20:25 +0700 Subject: [PATCH 5/5] Update PHP to version 8 --- Dockerfile | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 312fcbe..d8eb19f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.6 +FROM alpine:3.15 ARG BUILD_DATE ARG VCS_REF @@ -16,28 +16,35 @@ RUN set -e \ curl \ git \ patch \ - php7 \ - php7-apcu \ - php7-ctype \ - php7-json \ - php7-mbstring \ - php7-opcache \ - php7-openssl \ - php7-phar \ - php7-simplexml \ - php7-tokenizer \ - php7-xmlwriter \ - php7-zlib \ - && curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/bin \ - && composer global require drupal/coder --update-no-dev --no-suggest --prefer-dist ^8.3 \ + php8 \ + php8-pecl-apcu \ + php8-ctype \ + php8-mbstring \ + php8-opcache \ + php8-openssl \ + php8-phar \ + php8-simplexml \ + php8-tokenizer \ + php8-xmlwriter; + +RUN ln -s $(which php8) /usr/local/bin/php; + +RUN curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/bin \ + # Require Drupal coder module to have phpcs. \ + # https://www.drupal.org/project/coder + && composer global require drupal/coder --update-no-dev --prefer-dist ^8.3 \ + # Copy phpcs and phpcbf files into the binaries directory. && ln -s /root/.composer/vendor/bin/phpcs /usr/bin/phpcs \ && ln -s /root/.composer/vendor/bin/phpcbf /usr/bin/phpcbf \ + # Clone coder sniffs into the codesniffer sniffs directory. && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/Drupal \ && ln -s /root/.composer/vendor/drupal/coder/coder_sniffer/DrupalPractice /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalPractice \ + # Removing packages which needed only during the installation. && apk del --no-cache git \ + # Clear composer cache - it will just take space. && rm -rf /root/.composer/cache/* \ - && ln -s /root/drupalsecure_code_sniffs/DrupalSecure /root/.composer/vendor/squizlabs/php_codesniffer/src/Standards/DrupalSecure \ - && sed -i "s/.*memory_limit = .*/memory_limit = -1/" /etc/php7/php.ini + # Sniffs could take much time, we will set unlimited time for PHP execution + && sed -i "s/.*memory_limit = .*/memory_limit = -1/" /etc/php8/php.ini VOLUME /work WORKDIR /work