diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..e2b482e9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM debian:stable +ARG DEBIAN_FRONTEND=noninteractive +ARG XDEBUG_MODE=coverage +RUN apt update -y && apt install -y git composer php-cli php-dom php-curl php-xdebug vim +WORKDIR /app +CMD cd /app/generator/doc && ./update.sh && cd /app/generator && composer install && php ./safe.php generate && composer cs-fix diff --git a/.devcontainer/build.sh b/.devcontainer/build.sh new file mode 100755 index 00000000..f7b640c0 --- /dev/null +++ b/.devcontainer/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd $(dirname $0)/../ +docker run --rm -v ${PWD}:/app $(docker build -q -f .devcontainer/Dockerfile .) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..26b9f0ae --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Safe PHP", + "build": { + "context": "..", + "dockerfile": "./Dockerfile" + }, + + "workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind", + "workspaceFolder": "/app" +} diff --git a/.devcontainer/run.sh b/.devcontainer/run.sh new file mode 100755 index 00000000..d698c90c --- /dev/null +++ b/.devcontainer/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd $(dirname $0)/../ +docker run --rm -ti -v ${PWD}:/app $(docker build -q . -f .devcontainer/Dockerfile) /bin/bash diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ecb2c1b9..9f9cf3e8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,19 @@ Safe-PHP code is generated automatically from the PHP doc. +## Install dependencies + +### With a devcontainer + +If you use VSCode or similar, opening the project folder should prompt you to +re-open the folder inside a docker container with all the relevant tools +pre-installed. + +### Manually + +- php8.2+ CLI (with dom and curl modules) +- composer + ## How to install Safe-PHP development environment The first step is to download the PHP documentation project locally, using git.