From fa37dfb2b5c5fcebafae1837bef73f449a0908a5 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 21 Nov 2025 17:12:19 +0100 Subject: [PATCH 1/2] Pass full local path to docker Passing "." as path does not work with docker 20.10.24: > $ make > docker run --rm -v .:/var/www/en -w /var/www -u 1000:1000 php/doc-en > docker: Error response from daemon: create .: volume name is too short, names should be at least two alphanumeric characters. > See 'docker run --help'. > make: *** [Makefile:22: xhtml] Fehler 125 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 06fb38cb2072..ae8f8f7faab1 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ CURRENT_GID := $(shell id -g) # volumes to our Docker runs. # -PATHS := -v .:/var/www/en +PATHS := -v ${PWD}:/var/www/en ifneq ($(wildcard ../doc-base/LICENSE),) PATHS += -v ${PWD}/../doc-base:/var/www/doc-base endif From c851fd398683df57b1fb13da586fc02f31005fc4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 21 Nov 2025 17:18:25 +0100 Subject: [PATCH 2/2] Change permissions for cloned repositories The current user and group ID are passed passed to the docker build command and the ownership of the cloned directories are changed to them. This gets rid of git's "dubious ownership" error. Without this changes I got an error: > $ make > docker run --rm -v :/var/www/en -w /var/www -u 1000:1000 php/doc-en > configure.php on PHP 8.2.29, libxml 2.9.14 > > fatal: detected dubious ownership in repository at '/var/www/doc-base' > To add an exception for this directory, call: > > git config --global --add safe.directory /var/www/doc-base > doc-base/temp clean up FAILED. > make: *** [Makefile:22: xhtml] Fehler 1 Resolves: https://github.com/php/doc-en/pull/4645 --- .docker/Dockerfile | 5 ++++- Makefile | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 40a9bc44af7c..8f1f3b78ba94 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,6 @@ FROM php:8.2-cli +ARG UID=1000 +ARG GID=1000 RUN apt-get update && \ apt-get install -y git default-jre-headless @@ -9,7 +11,8 @@ ADD https://api.github.com/repos/php/phd/git/refs/heads/master version-phd.json ADD https://api.github.com/repos/php/doc-base/git/refs/heads/master version-doc-base.json RUN git clone --depth 1 https://github.com/php/phd.git && \ - git clone --depth 1 https://github.com/php/doc-base.git + git clone --depth 1 https://github.com/php/doc-base.git && \ + chown -R $UID:$GID phd doc-base RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini diff --git a/Makefile b/Makefile index ae8f8f7faab1..23db8ed335ff 100644 --- a/Makefile +++ b/Makefile @@ -28,5 +28,7 @@ php: .docker/built build: .docker/built .docker/built: - docker build .docker -t php/doc-en + docker build\ + --build-arg UID=${CURRENT_UID} --build-arg GID=${CURRENT_GID}\ + .docker -t php/doc-en touch .docker/built