feat(devcontainer): add devcontainer settings for dev environment

This commit is contained in:
Yassine Doghri 2020-05-29 12:37:35 +02:00
parent d523597515
commit 69e7266736
3 changed files with 48 additions and 0 deletions

11
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM php:latest
RUN apt-get update && apt-get install -y \
libicu-dev \
&& docker-php-ext-install intl
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git

View File

@ -0,0 +1,16 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"dockerFile": "./Dockerfile",
"settings": {
"terminal.integrated.shell.linux": null
},
"extensions": [
"mikestead.dotenv",
"bmewburn.vscode-intelephense-client",
"streetsidesoftware.code-spell-checker",
"naumovs.color-highlight",
"heybourn.headwind"
]
}

View File

@ -128,3 +128,24 @@ docker-compose down
```
Check [docker](https://docs.docker.com/engine/reference/commandline/docker/) and [docker-compose](https://docs.docker.com/compose/reference/) documentations for more insights.
### Developing inside a Container
If you're working in VSCode, you can take advantage of the `./.devcontainer/` folder. It defines a development container with preinstalled VSCode extensions so you don't have to worry about them. The container will be loaded with php, composer and git:
1. Install the VSCode extension [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
2. `Ctrl/Cmd + Shift + P` > `Open in container`
The VSCode window will reload inside the dev container.
You can check that the required packages are running in the console (`Terminal` > `New Terminal`):
```bash
php -v
composer -V
git version
```
For more info, see [VSCode Remote Containers](https://code.visualstudio.com/docs/remote/containers)