diff --git a/.devcontainer/configure-apache.sh b/.devcontainer/configure-apache.sh new file mode 100755 index 000000000000..b6fc4d7c8644 --- /dev/null +++ b/.devcontainer/configure-apache.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +if [ -z "$1" ] || [ ! -d "$1" ]; then + echo "Usage: $0 " + exit +fi + +sudo rm -rf /var/www/html +sudo chmod a+x "$1" +sudo ln -s "$1" /var/www/html && \ + echo "Apache web root directory set to $1" +if ! pgrep -x "apache2" > /dev/null; then + apache2ctl start +fi diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..8cfc860a93ce --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,41 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/php +{ + "name": "PHP", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/php:1-8.4-bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "extensions": [ + "editorconfig.editorconfig", + "ms-vscode.makefile-tools" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 8080 + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sudo .devcontainer/post-create.sh", + + // Environment variables to set globally inside the container. + "containerEnv": { + "BUILD_ENV": "devcontainer" + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 000000000000..3f9a0da567df --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +sed -i 's/Listen 80$//' /etc/apache2/ports.conf +sed -i 's//ServerName 127.0.0.1\n/' /etc/apache2/sites-enabled/000-default.conf diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 40a9bc44af7c..090be992f5f9 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -9,11 +9,12 @@ 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 1000:1000 /var/www RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini ENV FORMAT=xhtml -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 ${FORMAT} +CMD ["sh", "-c", "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 ${FORMAT}"] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000000..f33a02cd16e4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/Makefile b/Makefile index 06fb38cb2072..8d4c45bbfc58 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,16 @@ endif xhtml: .docker/built docker run --rm ${PATHS} -w /var/www -u ${CURRENT_UID}:${CURRENT_GID} php/doc-en + if [ -n "${BUILD_ENV}" ] && [ "${BUILD_ENV}" = "devcontainer" ]; then \ + .devcontainer/configure-apache.sh "${PWD}/output/php-chunked-xhtml"; \ + fi php: .docker/built docker run --rm ${PATHS} -w /var/www -u ${CURRENT_UID}:${CURRENT_GID} \ -e FORMAT=php php/doc-en + if [ -n "${BUILD_ENV}" ] && [ "${BUILD_ENV}" = "devcontainer" ]; then \ + .devcontainer/configure-apache.sh "${PWD}/output/php-web"; \ + fi build: .docker/built