From 84e01359598a18dc0df1e0b48fd9bad409a6b450 Mon Sep 17 00:00:00 2001 From: Bocki Date: Tue, 7 Mar 2023 17:10:36 +0100 Subject: [PATCH] [Core] github codespaces setup (#3287) --- .devcontainer/Dockerfile | 7 +++++ .devcontainer/devcontainer.json | 23 ++++++++++++++++ .devcontainer/launch.json | 49 +++++++++++++++++++++++++++++++++ .devcontainer/nginx.conf | 17 ++++++++++++ .devcontainer/xdebug.ini | 9 ++++++ 5 files changed, 105 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/launch.json create mode 100644 .devcontainer/nginx.conf create mode 100644 .devcontainer/xdebug.ini diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..311f9925 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM rssbridge/rss-bridge:latest + +RUN apt-get update && \ + apt-get install --yes --no-install-recommends \ + git && \ + pecl install xdebug && \ + docker-php-ext-enable xdebug \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..1425601e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "rss-bridge dev", + "build": { "dockerfile": "Dockerfile" }, + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "php.validate.executablePath": "/usr/local/bin/php" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "xdebug.php-debug", + "bmewburn.vscode-intelephense-client", + "philfontaine.autolaunch", + "eamodio.gitlens" + ] + } + }, + "forwardPorts": [3100, 9000, 9003], + "postCreateCommand": "cp .devcontainer/nginx.conf /etc/nginx/conf.d/default.conf && cp .devcontainer/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini && mkdir .vscode && cp .devcontainer/launch.json .vscode && echo '*' > whitelist.txt && chmod a+x \"$(pwd)\" && rm -rf /var/www/html && ln -s \"$(pwd)\" /var/www/html && nginx && php-fpm -D" +} \ No newline at end of file diff --git a/.devcontainer/launch.json b/.devcontainer/launch.json new file mode 100644 index 00000000..e1b473b8 --- /dev/null +++ b/.devcontainer/launch.json @@ -0,0 +1,49 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003, + "auto": true + }, + { + "name": "Launch currently open script", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "port": 0, + "runtimeArgs": [ + "-dxdebug.start_with_request=yes" + ], + "env": { + "XDEBUG_MODE": "debug,develop", + "XDEBUG_CONFIG": "client_port=${port}" + } + }, + { + "name": "Launch Built-in web server", + "type": "php", + "request": "launch", + "runtimeArgs": [ + "-dxdebug.mode=debug", + "-dxdebug.start_with_request=yes", + "-S", + "localhost:0" + ], + "program": "", + "cwd": "${workspaceRoot}", + "port": 9003, + "serverReadyAction": { + "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started", + "uriFormat": "http://localhost:%s", + "action": "openExternally" + } + } + ] +} \ No newline at end of file diff --git a/.devcontainer/nginx.conf b/.devcontainer/nginx.conf new file mode 100644 index 00000000..46502cb4 --- /dev/null +++ b/.devcontainer/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 3100 default_server; + root /workspaces/rss-bridge; + access_log /var/log/nginx/rssbridge.access.log; + error_log /var/log/nginx/rssbridge.error.log; + index index.php; + + location ~ /(\.|vendor|tests) { + deny all; + return 403; # Forbidden + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass 127.0.0.1:9000; + } +} \ No newline at end of file diff --git a/.devcontainer/xdebug.ini b/.devcontainer/xdebug.ini new file mode 100644 index 00000000..9c5f1f10 --- /dev/null +++ b/.devcontainer/xdebug.ini @@ -0,0 +1,9 @@ +zend_extension=xdebug.so + +[xdebug] +xdebug.mode=develop,debug +xdebug.client_host=localhost +xdebug.client_port=9003 +xdebug.start_with_request=yes +xdebug.discover_client_host=false +xdebug.log='/var/www/html/xdebug.log' \ No newline at end of file