3
3
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4
4
# -------------------------------------------------------------------------------------------------------------
5
5
6
- FROM mcr.microsoft.com/dotnet/core/sdk:2.2
6
+ ARG DOTNETCORE_VESRION=2.2
7
+ FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNETCORE_VESRION}
7
8
8
- # # This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
9
+ # This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
9
10
# this user's GID/UID must match your local user UID/GID to avoid permission issues
10
11
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
11
12
# https://aka.ms/vscode-remote/containers/non-root-user for details.
@@ -15,7 +16,8 @@ ARG USER_GID=$USER_UID
15
16
16
17
# [Optional] Version of Node.js to install.
17
18
ARG INSTALL_NODE="true"
18
- ARG NODE_MAJOR_VERSION="10"
19
+ ARG NODE_VERSION="lts/*"
20
+ ENV NVM_DIR=/home/vscode/.nvm
19
21
20
22
# [Optional] Install the Azure CLI
21
23
ARG INSTALL_AZURE_CLI="false"
@@ -30,10 +32,34 @@ RUN apt-get update \
30
32
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
31
33
&& apt-get -y install git iproute2 procps lsb-release \
32
34
#
35
+ # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
36
+ && groupadd --gid $USER_GID $USERNAME \
37
+ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
38
+ # [Optional] Add sudo support for the non-root user
39
+ && apt-get install -y sudo \
40
+ && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
41
+ && chmod 0440 /etc/sudoers.d/$USERNAME \
42
+ #
33
43
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
34
44
&& if [ "$INSTALL_NODE" = "true" ]; then \
35
- curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
36
- && apt-get install -y nodejs; \
45
+ #
46
+ # Install nvm and Node
47
+ mkdir ${NVM_DIR} \
48
+ && curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 2>&1 \
49
+ && chown -R vscode:vscode ${NVM_DIR} \
50
+ && /bin/bash -c "source $NVM_DIR/nvm.sh \
51
+ && nvm install ${NODE_VERSION} \
52
+ && nvm alias default ${NODE_VERSION}" 2>&1 \
53
+ && INIT_STRING='[ -s "$NVM_DIR/nvm.sh" ] && \\ . "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \\ . "$NVM_DIR/bash_completion"' \
54
+ && echo $INIT_STRING >> /home/vscode/.bashrc \
55
+ && echo $INIT_STRING >> /home/vscode/.zshrc \
56
+ && echo $INIT_STRING >> /root/.zshrc \
57
+ #
58
+ # Install yarn
59
+ && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]' )/pubkey.gpg | apt-key add - 2>/dev/null \
60
+ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
61
+ && apt-get update \
62
+ && apt-get -y install --no-install-recommends yarn; \
37
63
fi \
38
64
#
39
65
# [Optional] Install the Azure CLI
@@ -45,14 +71,6 @@ RUN apt-get update \
45
71
&& apt-get install -y azure-cli; \
46
72
fi \
47
73
#
48
- # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
49
- && groupadd --gid $USER_GID $USERNAME \
50
- && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
51
- # [Optional] Add sudo support for the non-root user
52
- && apt-get install -y sudo \
53
- && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
54
- && chmod 0440 /etc/sudoers.d/$USERNAME \
55
- #
56
74
# Clean up
57
75
&& apt-get autoremove -y \
58
76
&& apt-get clean -y \
0 commit comments