From 3de5ba7ab5a32262fb7f4a77e49f3715f0cc98e3 Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Tue, 8 Oct 2024 11:57:36 -0600 Subject: [PATCH] Add support for VSCode devcontainer. --- .devcontainer.json | 128 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 7 ++- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .devcontainer.json diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..781a6ad --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,128 @@ +{ + "name": "TripalDocker-BLAST", + "build": { + "dockerfile": "Dockerfile", + "args": { + "drupalversion": "10.4.x-dev", + "phpversion": "8.3", + "pgsqlversion": "16" + } + }, + "workspaceMount": "source=${localWorkspaceFolder},target=/var/www/drupal/web/modules/contrib/tripal_blast,type=bind", + "workspaceFolder": "/var/www/drupal/web/modules/contrib/tripal_blast", + "customizations": { + "vscode": { + "extensions": [ + "neilbrayfield.php-docblocker", + "bmewburn.vscode-intelephense-client", + "recca0120.vscode-phpunit", + "swordev.phpstan", + "andrewdavidblum.drupal-smart-snippets", + "DEVSENSE.composer-php-vscode", + "mblode.twig-language-2", + "redhat.vscode-yaml", + "ms-azuretools.vscode-docker", + "github.vscode-github-actions", + "GitHub.vscode-pull-request-github" + ], + "settings": { + // This turns off basic PHP suggestions provided by Visual Studio Code (in lieu of Intelephense's). + "php.suggest.basic": false, + /* Coding Standards */ + "css.validate": true, + "diffEditor.ignoreTrimWhitespace": false, + "editor.tabSize": 2, + "editor.autoIndent": "full", + "editor.insertSpaces": true, + "editor.formatOnPaste": true, + "editor.formatOnSave": false, + "editor.renderWhitespace": "boundary", + "editor.wordWrapColumn": 80, + "editor.wordWrap": "on", + "editor.detectIndentation": true, + "editor.rulers": [ + 80 + ], + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "html.format.enable": true, + "html.format.wrapLineLength": 80, + /* Chosing which language a file is; Drupal-focused */ + "files.associations": { + "*.inc": "php", + "*.module": "php", + "*.install": "php", + "*.theme": "php", + "*.profile": "php", + "*.tpl.php": "php", + "*.test": "php", + "*.php": "php", + "*.info": "ini", + "*.html": "twig" + }, + "emmet.includeLanguages": { + "twig": "html" + }, + /* Performance Related. Exludes from indexing */ + /*files.exclude and files.watcherExclude settings via https://github.com/microsoft/vscode/issues/11963#issuecomment-317830768 */ + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/tmp": true, + "**/node_modules": true, + "**/bower_components": true, + "**/dist": true + }, + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/**": true, + "**/tmp/**": true, + "**/bower_components/**": true, + "**/dist/**": true + }, + /* PHP Linting */ + "php.validate.enable": true, + "php.validate.executablePath": "/usr/local/bin/php", + "php.validate.run": "onType", + "[php]": { + "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" + }, + /* PHP DocBlocker */ + "php-docblocker.gap": true, + "php-docblocker.useShortNames": true, + /* PHP Intelephense */ + // Intelephense and Drupal >8 only. This should be set to the path to web/index.php. + "intelephense.environment.documentRoot": "/var/www/drupal/web/index.php", + // Intelephense only: For Drupal compliant braces formatting use: + "intelephense.format.braces": "k&r", + // Indicate where to find additional classes. + "intelephense.environment.includePaths": [ + "/var/www/drupal/web/core/", + "/var/www/drupal/vendor/", + "/var/www/drupal/web/modules/" + ], + "intelephense.diagnostics.enable": false, + /* PHPUnit Test Explorer */ + "phpunit.phpunit": "/var/www/drupal/vendor/bin/phpunit", + /* Drupal Smart Snippets */ + // Use this to prioritize Drupal Smart Snippets in the UI. + "editor.snippetSuggestions": "top", + /* Composer */ + "composer.bin": "/usr/local/bin/composer", + "tws.trimOnSave": true, + "tws.highlightTrailingWhiteSpace": true + } + } + }, + "forwardPorts": [ + 80, + 5432, + 9003 + ], + "postCreateCommand": "init.sh" +} diff --git a/Dockerfile b/Dockerfile index 537d336..85de9c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG drupalversion='10.2.x-dev' ARG phpversion='8.3' ARG pgsqlversion="16" -FROM tripalproject/tripaldocker:drupal${drupalversion}-php${phpversion}-pgsql${pgsqlversion}-noChado +FROM tripalproject/tripaldocker:drupal${drupalversion}-php${phpversion}-pgsql${pgsqlversion} LABEL org.opencontainers.image.source=https://github.com/tripal/tripal_blast LABEL org.opencontainers.image.description="Provides a demonstration of the Tripal BLAST module installed in the most recent version of Tripal 4" @@ -19,3 +19,8 @@ RUN cd / \ WORKDIR /var/www/drupal/web/modules/contrib/tripal_blast RUN service postgresql restart \ && drush en tripal_blast --yes + +## Set files directory permissions +RUN chown -R www-data:www-data /var/www/drupal \ + && chmod 775 -R /var/www/drupal/web/sites/default/files \ + && usermod -g www-data root