From a51136d494da2d52c0842a4adf6a45995ea19237 Mon Sep 17 00:00:00 2001 From: Denis Trofimov Date: Mon, 18 May 2026 15:14:35 +0300 Subject: [PATCH 1/3] Fix Docker build by using Debian Buster archive mirrors. The php:7.2-cli image is based on EOL Debian Buster; apt-get update fails against the default mirrors. Point apt at archive.debian.org and document the requirement in the README. --- Dockerfile | 6 ++++++ README.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 1bc72cec2..d429bba63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,11 @@ FROM php:7.2-cli +# Debian Buster (base of php:7.2-cli) is EOL; package indexes moved to archive.debian.org. +RUN set -xe \ + && sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list \ + && sed -i 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && sed -i '/buster-updates/d' /etc/apt/sources.list + RUN set -xe \ && apt-get update \ && apt-get install -qqy libicu-dev locales libgmp-dev \ diff --git a/README.md b/README.md index 95c18a1a3..80b0b11d4 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,8 @@ $ composer test Money requires a set of dependencies, so you might want to run it in Docker. +The image is based on `php:7.2-cli`, which uses Debian Buster. That release is end-of-life, so the Dockerfile points `apt` at [archive.debian.org](https://archive.debian.org/debian/) before installing extensions. Without that step, `docker build` fails during `apt-get update` with errors such as `404 Not Found` on `security.debian.org` or missing Release files for Buster. + First, build the image locally: ```bash From 07ac46b6c85b15c5722b34599dcaaac3f3b6932f Mon Sep 17 00:00:00 2001 From: Denis Trofimov Date: Mon, 18 May 2026 15:33:04 +0300 Subject: [PATCH 2/3] Align Docker PHP version with host vendor dependencies. php:7.2-cli cannot parse dev packages installed on PHP 7.4 (e.g. phpdocumentor/reflection-docblock), which caused 200+ PHPUnit errors. Use php:7.4-cli-buster and document the version mismatch in the README. --- Dockerfile | 4 ++-- README.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d429bba63..d010e67fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM php:7.2-cli +FROM php:7.4-cli-buster -# Debian Buster (base of php:7.2-cli) is EOL; package indexes moved to archive.debian.org. +# Debian Buster (base of php:7.4-cli-buster) is EOL; package indexes moved to archive.debian.org. RUN set -xe \ && sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list \ && sed -i 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ diff --git a/README.md b/README.md index 80b0b11d4..73679efe6 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,9 @@ $ composer test Money requires a set of dependencies, so you might want to run it in Docker. -The image is based on `php:7.2-cli`, which uses Debian Buster. That release is end-of-life, so the Dockerfile points `apt` at [archive.debian.org](https://archive.debian.org/debian/) before installing extensions. Without that step, `docker build` fails during `apt-get update` with errors such as `404 Not Found` on `security.debian.org` or missing Release files for Buster. +The image is based on `php:7.4-cli-buster`, which uses Debian Buster. That release is end-of-life, so the Dockerfile points `apt` at [archive.debian.org](https://archive.debian.org/debian/) before installing extensions. Without that step, `docker build` fails during `apt-get update` with errors such as `404 Not Found` on `security.debian.org` or missing Release files for Buster. + +Use the same PHP major version in Docker as the one you used for `composer install` on the host. The container mounts your local `vendor/` directory; if Docker runs an older PHP (for example 7.2 while dependencies were resolved on 7.4), PHPUnit can fail with hundreds of `ParseError`s in `vendor/` (often in packages used by Prophecy, such as `phpdocumentor/reflection-docblock`). First, build the image locally: From 04ae021720f756295d08f1bd8f6ad1d78e67bbb9 Mon Sep 17 00:00:00 2001 From: Denis Trofimov Date: Tue, 19 May 2026 12:15:19 +0300 Subject: [PATCH 3/3] Document one-off composer install inside Docker. Add README instructions for installing dependencies in the container when vendor/ is missing and Composer is not baked into the image. --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 73679efe6..9afad25d7 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,21 @@ First, build the image locally: $ docker build -t moneyphp . ``` +Optional: run composer install fully inside Docker +The image doesn’t include Composer. +One-off install, (use single quotes around the whole script — not backticks): + +```bash +docker run --rm -it -v $PWD:/app -w /app moneyphp bash -c ' + apt-get update -qq && + apt-get install -y -qq git unzip && + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && + git config --global --add safe.directory /app && + composer config allow-plugins.php-http/discovery true && + composer install --no-interaction +' +``` + Then run the tests: ```bash