Skip to content

Commit 052449c

Browse files
committed
Add Node support to devcontainer
1 parent ad28e5d commit 052449c

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@ ARG VARIANT="3"
22

33
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
44

5+
ARG NODE_VERSION="20"
56
ARG POETRY_VERSION="1.8.2"
67
ARG POETRY_SRC="https://install.python-poetry.org"
78

9+
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/base.Dockerfile
10+
ENV USERNAME=vscode
11+
ENV LIBRARY_SCRIPTS_SRC="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/containers/go/.devcontainer/library-scripts/node-debian.sh"
12+
ENV NVM_DIR=/usr/local/share/nvm
13+
ENV NVM_SYMLINK_CURRENT=true \
14+
PATH=${NVM_DIR}/current/bin:${PATH}
15+
RUN mkdir /tmp/library-scripts \
16+
&& curl -fsSL -o /tmp/library-scripts/node-debian.sh "${LIBRARY_SCRIPTS_SRC}"
17+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
18+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* \
19+
&& rm -rf /tmp/library-scripts
20+
821
USER vscode
922
WORKDIR /home/vscode
1023

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"build": {
55
"dockerfile": "Dockerfile",
66
"args": {
7+
"NODE_VERSION": "20",
78
"POETRY_VERSION": "1.8.2",
89
"VARIANT": "3.12"
910
}
@@ -17,6 +18,6 @@
1718
"ms-python.python",
1819
"EditorConfig.EditorConfig"
1920
],
20-
"postCreateCommand": "poetry install",
21+
"postCreateCommand": "poetry install && npm install",
2122
"remoteUser": "vscode"
2223
}

0 commit comments

Comments
 (0)