Skip to content

Commit

Permalink
Add devcontainer config
Browse files Browse the repository at this point in the history
(breaking shish/safe down into smaller parts for easier merging)

These configs make it so that one can open the Safe project in a compatible editor (eg vscode) and the IDE will do all the work (eg build, test) in a self-contained container with all the right versions of all the right tools installed. This is particularly useful for Safe, whose build process only runs with specific PHP versions, which may differ from what is installed on the developer's host system.
  • Loading branch information
shish committed Nov 28, 2024
1 parent 3a6e43b commit 2f1e0d8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .devcontainer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd $(dirname $0)/../
docker run --rm -v ${PWD}:/app $(docker build -q -f .devcontainer/Dockerfile .)
10 changes: 10 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Safe PHP",
"build": {
"context": "..",
"dockerfile": "./Dockerfile"
},

"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceFolder": "/app"
}
3 changes: 3 additions & 0 deletions .devcontainer/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd $(dirname $0)/../
docker run --rm -ti -v ${PWD}:/app $(docker build -q . -f .devcontainer/Dockerfile) /bin/bash

0 comments on commit 2f1e0d8

Please sign in to comment.