RSS-Bridge.rss-bridge/.devcontainer/post-create-command.sh
Thiago Ferreira daef06c6dd
devcontainer: Fixed Dev Containers setup (#4556)
The current setup for Dev Containers was not working, with multiple
different errors. So, in order to restore its funcionality (and allow
for things like linting and debugging), the following changes were made:

- The Dockerfile was severely alterered. Now, the `docker-php-ext-enable` binary is installed before its usage,
  it points to the correct PHP binary, and we install Composer for for
  loading dev-dependencies later-on.

- Moved the "postCreateCommand" section (defined on the `devcontainer.json` file) into its own script file (for a
  more readable experience)

- On the post-creation script, moved the `xdebug.ini` to the correct
  directory (alongside the PHP-FPM bin), installed PHPUnit,
  PHPCodesniffer (and the 'PHP Compatibility' sniffer) with Composer on
  a global location, and changed owner of the `cache` directory

- Changed VSCode-specific customization setting in order to point to the
  update some binary paths. Also made sure globally-installed composer
  packages binaries are accessible via PATHdocker-php-ext-enable
2025-05-24 19:18:52 +02:00

27 lines
No EOL
833 B
Bash
Executable file

#/bin/sh
cp .devcontainer/nginx.conf /etc/nginx/conf.d/default.conf
cp .devcontainer/xdebug.ini /etc/php/8.2/fpm/conf.d/xdebug.ini
# This should download some dev-dependencies, like phpunit and the PHP code sniffers
composer global require "phpunit/phpunit:^9"
composer global require "squizlabs/php_codesniffer:^3.6"
composer global require "phpcompatibility/php-compatibility:^9.3"
# We need to this manually for running the PHPCompatibility ruleset
phpcs --config-set installed_paths /root/.config/composer/vendor/phpcompatibility/php-compatibility
mkdir -p .vscode
cp .devcontainer/launch.json .vscode
echo '*' > whitelist.txt
chmod a+x $(pwd)
rm -rf /var/www/html
ln -s $(pwd) /var/www/html
# Solves possible issue of cache directory not being accessible
chown www-data:www-data -R $(pwd)/cache
nginx
php-fpm8.2 -D