diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c55d765a..a4f78d98 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,8 +1,14 @@ -FROM node:lts +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/typescript-node/.devcontainer/base.Dockerfile -WORKDIR /workspaces +ARG VARIANT="14" +FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT} # Set an environment variable to be able to detect we are in dev container ENV NODE_ENV=devcontainer EXPOSE 3000 + +COPY .nvmrc /tmp/.nvmrc +RUN \ + su node -c \ + "source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 869758f3..da6e8e02 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,29 +1,29 @@ { - "name": "developers.home-assistant", - "dockerFile": "Dockerfile", - "appPort": [ - 3000 - ], - "postCreateCommand": "yarn install", - "extensions": [ - "davidanson.vscode-markdownlint", - "editorconfig.editorconfig", - "streetsidesoftware.code-spell-checker", - "yzhang.markdown-all-in-one" - ], - "settings": { - "editor.rulers": [80, 100, 120], - "editor.renderWhitespace": "boundary", - "errorLens.gutterIconsEnabled": true, - "errorLens.addAnnotationTextPrefixes": false, - "errorLens.enabledDiagnosticLevels": [ - "error", - "warning" - ], - "terminal.integrated.shell.linux": "/bin/bash", - "[markdown]":{ - "editor.wordWrap": "wordWrapColumn", - "editor.wordWrapColumn": 80, - } + "name": "developers.home-assistant", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "appPort": [3000], + "postCreateCommand": "script/setup", + "extensions": [ + "davidanson.vscode-markdownlint", + "editorconfig.editorconfig", + "streetsidesoftware.code-spell-checker", + "yzhang.markdown-all-in-one", + "esbenp.prettier-vscode" + ], + "settings": { + "editor.rulers": [80, 100, 120], + "editor.renderWhitespace": "boundary", + "errorLens.gutterIconsEnabled": true, + "errorLens.addAnnotationTextPrefixes": false, + "errorLens.enabledDiagnosticLevels": ["error", "warning"], + "[markdown]": { + "editor.wordWrap": "wordWrapColumn", + "editor.wordWrapColumn": 80 } + }, + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node" }