diff --git a/Dockerfile b/Dockerfile index aadcf20..354c85c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,26 @@ # This Dockerfile can be used to create a Docker image/container # that runs the unit tests on the LinkTitles extension. -FROM mediawiki:1.34 -MAINTAINER Daniel Kraus (https://www.bovender.de) -RUN apt update -yqq && \ - apt install -yqq \ - php7.0-sqlite \ +FROM mediawiki:1.35 +LABEL "MAINTAINER" Daniel Kraus (https://www.bovender.de) +RUN apt-get update -yqq && \ + apt-get install -yqq \ + php7.3-sqlite \ sqlite3 \ unzip \ zip -RUN curl https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer -s | php -- --quiet -RUN php composer.phar install + +WORKDIR /var/www/html +ADD install-composer.sh install-composer.sh +RUN chmod +x install-composer.sh +RUN ./install-composer.sh COPY . /var/www/html/extensions/LinkTitles/ RUN mkdir /data && chown www-data /data +RUN php composer.phar update + WORKDIR /var/www/html/maintenance -RUN php install.php --pass admin --dbtype sqlite --extensions LinkTitles Tests admin +RUN php install.php --pass linktitles --dbtype sqlite --extensions LinkTitles Tests admin WORKDIR /var/www/html/tests/phpunit CMD ["php", "phpunit.php", "--group", "bovender"] diff --git a/install-composer.sh b/install-composer.sh new file mode 100644 index 0000000..9aa0c1f --- /dev/null +++ b/install-composer.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This is a slightly modified version of the installer script published at +# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md +# It does not depend on `wget` and uses `curl` instead. + +EXPECTED_CHECKSUM="$(curl -q https://composer.github.io/installer.sig)" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + +if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] +then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 +fi + +# May need to remove the explicit pinning of version 1 in the future +php composer-setup.php --quiet --1 +RESULT=$? +rm composer-setup.php +exit $RESULT