From 376946262a831ca1a1e4f9ba6cfc00cc38b38e35 Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Wed, 2 Aug 2023 16:15:58 -0400 Subject: [PATCH 1/8] Create a docker container for a single-line setup and rendering Use case: a casual contributor who wants to preview their changes before opening a PR. There is currently no way to provide custom args to phd/render.php, because then we'd be back to complicated instructions. I tried not to make any assumptions about the host system, so I don't use make. This image is tied to an older commit of phd, since a (very) recent commit causes a crash on `assert($this->cchunk["classsynopsis"]["legacy"] === true);`. I'll just assume that it's a regression, since it fails on 2 machines and 2 PHP versions. I don't want to go down that rabbit hole today. --- .docker/Dockerfile | 15 +++++++++++++++ .gitignore | 1 + README | 5 +++++ docker-compose.yml | 8 ++++++++ 4 files changed, 29 insertions(+) create mode 100644 .docker/Dockerfile create mode 100644 docker-compose.yml diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 000000000000..8e4466ff432d --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.2-cli + +RUN apt-get update ; \ + apt-get install -y git + +WORKDIR /var/www + +RUN git clone https://github.com/php/phd.git ; \ + git clone https://github.com/php/doc-base.git ; \ + git -C phd checkout 5708881e233cd9979dd11bcbd9fd0bb8a714f9d5 + +RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini + +CMD php doc-base/configure.php --disable-segfault-error ; \ + php phd/render.php --docbook doc-base/.manual.xml --output=/var/www/en/output --package PHP --format xhtml diff --git a/.gitignore b/.gitignore index b2f1b48faafa..8e0450061c78 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ entities.*.xml +output diff --git a/README b/README index ba8bcb3f7975..ae533de2a4ad 100644 --- a/README +++ b/README @@ -7,3 +7,8 @@ Please refer to the README file within the [doc-base repository](https://github. For information related to creating this setup, see: http://doc.php.net/tutorial/local-setup.php + +Running With Docker + +- Rebuild the documentation using `docker-compose up` +- Open output/php-chunked-xhtml/ in your browser. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000000..f3cec69bcea6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' + +services: + doc: + build: .docker + working_dir: /var/www + volumes: + - .:/var/www/en From c46c90bca304714a51d3e2ce08fc22d69cc7f1fc Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Wed, 2 Aug 2023 19:05:03 -0400 Subject: [PATCH 2/8] Replace ; with && to fail fast --- .docker/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 8e4466ff432d..a1bcaf19d989 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,15 +1,15 @@ FROM php:8.2-cli -RUN apt-get update ; \ +RUN apt-get update && \ apt-get install -y git WORKDIR /var/www -RUN git clone https://github.com/php/phd.git ; \ - git clone https://github.com/php/doc-base.git ; \ +RUN git clone https://github.com/php/phd.git && \ + git clone https://github.com/php/doc-base.git && \ git -C phd checkout 5708881e233cd9979dd11bcbd9fd0bb8a714f9d5 RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini -CMD php doc-base/configure.php --disable-segfault-error ; \ +CMD php doc-base/configure.php --disable-segfault-error && \ php phd/render.php --docbook doc-base/.manual.xml --output=/var/www/en/output --package PHP --format xhtml From 6ce512ed595903d6fb98ded231160643ba29e58d Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Thu, 3 Aug 2023 10:03:03 -0400 Subject: [PATCH 3/8] Clone with --depth 1 for performance --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index a1bcaf19d989..d1d04e8f48c2 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && \ WORKDIR /var/www RUN git clone https://github.com/php/phd.git && \ - git clone https://github.com/php/doc-base.git && \ + git clone --depth 1 https://github.com/php/doc-base.git && \ git -C phd checkout 5708881e233cd9979dd11bcbd9fd0bb8a714f9d5 RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini From 818d17ccd8518d7e5f36ff96aca45ddfb73fe3b0 Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Thu, 3 Aug 2023 10:03:33 -0400 Subject: [PATCH 4/8] Provide link to install Docker --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index ae533de2a4ad..802a2b91a8a2 100644 --- a/README +++ b/README @@ -10,5 +10,6 @@ For information related to creating this setup, see: Running With Docker +- Install [Docker](https://docs.docker.com/get-docker/). - Rebuild the documentation using `docker-compose up` - Open output/php-chunked-xhtml/ in your browser. From 7cad50c9b2c2833ae6a02808640ff99b82e1ef6f Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Thu, 3 Aug 2023 10:04:47 -0400 Subject: [PATCH 5/8] Remove markdown syntax --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 802a2b91a8a2..faf793844184 100644 --- a/README +++ b/README @@ -10,6 +10,6 @@ For information related to creating this setup, see: Running With Docker -- Install [Docker](https://docs.docker.com/get-docker/). +- Install Docker (https://docs.docker.com/get-docker/ - Rebuild the documentation using `docker-compose up` - Open output/php-chunked-xhtml/ in your browser. From 6e513cd23e4f8f88bccae65d9c953a9a5d606fa5 Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Thu, 3 Aug 2023 10:09:18 -0400 Subject: [PATCH 6/8] Resrore dropped parenthesis at the end --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index faf793844184..734a28561eea 100644 --- a/README +++ b/README @@ -10,6 +10,6 @@ For information related to creating this setup, see: Running With Docker -- Install Docker (https://docs.docker.com/get-docker/ +- Install Docker (https://docs.docker.com/get-docker/) - Rebuild the documentation using `docker-compose up` - Open output/php-chunked-xhtml/ in your browser. From 7057efc287ad8170171c257342a187eb692a55a2 Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Thu, 3 Aug 2023 13:19:34 -0400 Subject: [PATCH 7/8] No longer pin phd to an older commit, since doc was fixed --- .docker/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index d1d04e8f48c2..5d503cbc03f5 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -5,9 +5,8 @@ RUN apt-get update && \ WORKDIR /var/www -RUN git clone https://github.com/php/phd.git && \ - git clone --depth 1 https://github.com/php/doc-base.git && \ - git -C phd checkout 5708881e233cd9979dd11bcbd9fd0bb8a714f9d5 +RUN git clone --depth 1 https://github.com/php/phd.git && \ + git clone --depth 1 https://github.com/php/doc-base.git RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini From 51ebfca721b16d471b8d393c520b4dc6d53fb461 Mon Sep 17 00:00:00 2001 From: Anna Filina Date: Mon, 7 Aug 2023 17:06:46 -0400 Subject: [PATCH 8/8] Accept code that alledgedly busts the git cache Co-authored-by: Lewis Cowles --- .docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 5d503cbc03f5..5124ba39cef3 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -5,6 +5,9 @@ RUN apt-get update && \ WORKDIR /var/www +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