Skip to content

Commit c21ecfe

Browse files
committed
Added devcontainer support
1 parent 76861d2 commit c21ecfe

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# [Choice] Node.js version: 14, 12, 10
2+
ARG VARIANT=14
3+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
4+
USER root
5+
RUN apt-get update
6+
7+
ARG USER_UID=1000
8+
ARG USER_GID=$USER_UID
9+
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
10+
groupmod --gid $USER_GID node \
11+
&& usermod --uid $USER_UID --gid $USER_GID node \
12+
&& chmod -R $USER_UID:$USER_GID /home/node \
13+
&& chmod -R $USER_UID:root /usr/local/share/nvm /usr/local/share/npm-global; \
14+
fi

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Node.js",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
// Update 'VARIANT' to pick a Node version: 10, 12, 14
6+
"args": { "VARIANT": "14" }
7+
},
8+
9+
// Set *default* container specific settings.json values on container create.
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/bash"
12+
},
13+
14+
// Add the IDs of extensions you want installed when the container is created.
15+
"extensions": [
16+
"dbaeumer.vscode-eslint",
17+
"octref.vetur",
18+
"liuji-jim.vue",
19+
"eamodio.gitlens",
20+
"wix.vscode-import-cost",
21+
"mrmlnc.vscode-scss"
22+
],
23+
24+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
25+
"forwardPorts": [9000],
26+
27+
// Use 'postCreateCommand' to run commands after the container is created.
28+
// "postCreateCommand": "yarn install",
29+
30+
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
31+
"remoteUser": "node"
32+
}

0 commit comments

Comments
 (0)