From b7b468765ac0fcf19b5c7065e24f3ea0d3134b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= Date: Tue, 8 Oct 2019 09:11:02 -0300 Subject: [PATCH] Add sample configuration for Visual Studio Code Remote Development on Containers. --- .devcontainer/devcontainer.example.json | 9 +++++++++ .gitignore | 5 ++++- DOCUMENTATION/content/guides/index.md | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.example.json diff --git a/.devcontainer/devcontainer.example.json b/.devcontainer/devcontainer.example.json new file mode 100644 index 00000000..4be22f7f --- /dev/null +++ b/.devcontainer/devcontainer.example.json @@ -0,0 +1,9 @@ +{ + "name": "Laradock", + "dockerComposeFile": ["../docker-compose.yml"], + "runServices": ["nginx", "postgres", "pgadmin"], + "service": "workspace", + "workspaceFolder": "/var/www", + "shutdownAction": "stopCompose", + "postCreateCommand": "uname -a" +} diff --git a/.gitignore b/.gitignore index 06732062..06eccb52 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,7 @@ /nginx/ssl/*.key /nginx/ssl/*.csr -.DS_Store \ No newline at end of file +/.devcontainer/* +!/.devcontainer/devcontainer.example.json + +.DS_Store diff --git a/DOCUMENTATION/content/guides/index.md b/DOCUMENTATION/content/guides/index.md index 9ffd0140..ab8c9c7e 100644 --- a/DOCUMENTATION/content/guides/index.md +++ b/DOCUMENTATION/content/guides/index.md @@ -70,6 +70,16 @@ If you want to only execute some command and don't want to enter bash, you can e docker-compose run workspace php artisan migrate ``` +### Prepare for Visual Studio Code remote development + +If you want to use Visual Studio Code for [remote development](https://code.visualstudio.com/docs/remote/containers) directly on your `workspace` container, copy file `devcontainer.example.json` to `devcontainer.json` and customize it (see [devcontainer.json reference](https://code.visualstudio.com/docs/remote/containers#_devcontainerjson-reference) for more options): +``` +cd .devcontainer +cp devcontainer.example.json devcontainer.json +``` + +Then open your `laradock` folder in Visual Studio Code and click on popup button **Reopen in Container**. + ### Install and configure Laravel Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.