From 1337771f59c74890d0213c159e06e4d4ac763970 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 10 May 2021 23:10:12 +0000 Subject: [PATCH] Allow the project to be run in a docker-volume --- .devcontainer/devcontainer.json | 5 ++--- .devcontainer/docker-compose.yml | 8 ++++---- .devcontainer/post-create.sh | 6 ++++++ 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .devcontainer/post-create.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index aa492dc..0404319 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,10 +2,9 @@ "name": "SilverStripe Environment", "dockerComposeFile": "docker-compose.yml", "service": "silverstripe", - "workspaceFolder": "/vscode/src/mantra", + "workspaceFolder": "/shared-workspaces/mantra", "extensions": [ "adrianhumphreys.silverstripe", - "dbaeumer.vscode-eslint", "felixfbecker.php-pack", "ms-vscode.vscode-typescript-tslint-plugin", "neilbrayfield.php-docblocker" @@ -13,5 +12,5 @@ "settings": { "php.executablePath": null }, - "postCreateCommand": "echo '* text=auto eol=lf' > $(git rev-parse --git-dir)/info/attributes" + "postCreateCommand": "bash ./.devcontainer/post-create.sh" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 988dee6..5faa1c0 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -16,11 +16,11 @@ services: - 3000:3000 - 3001:3001 - 9000:9000 + working_dir: /shared-workspaces/mantra volumes: - - ..:/vscode/src/mantra - - ../test/website:/var/www/html - - main-node:/vscode/src/mantra/node_modules/ - - main-composer:/vscode/src/mantra/vendor/ + - ..:/shared-workspaces/mantra + - main-node:/shared-workspaces/mantra/node_modules/ + - main-composer:/shared-workspaces/mantra/vendor/ db: image: mysql:5 env_file: devcontainer.env diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..ca2909e --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,6 @@ +#!/bin/bash +echo '* text=auto eol=lf' > $(git rev-parse --git-dir)/info/attributes +rm -rf /var/www/html +ln -sT `pwd`/test/website /var/www/html +chown -R www-data:www-data ./test/website +chown -R www-data:www-data /var/www/html