Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 487e3fa

Browse files
committed
Enable optional installation of Node and the Azure CLI
1 parent 8609e25 commit 487e3fa

File tree

6 files changed

+136
-25
lines changed

6 files changed

+136
-25
lines changed

containers/dotnetcore-2.1/.devcontainer/Dockerfile

+26-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
77

8-
# Avoid warnings by switching to noninteractive
9-
ENV DEBIAN_FRONTEND=noninteractive
10-
118
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
129
# this user's GID/UID must match your local user UID/GID to avoid permission issues
1310
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
@@ -16,13 +13,38 @@ ARG USERNAME=vscode
1613
ARG USER_UID=1000
1714
ARG USER_GID=$USER_UID
1815

16+
# [Optional] Version of Node.js to install.
17+
ARG INSTALL_NODE="true"
18+
ARG NODE_MAJOR_VERSION="10"
19+
20+
# [Optional] Install the Azure CLI
21+
ARG INSTALL_AZURE_CLI="false"
22+
23+
# Avoid warnings by switching to noninteractive
24+
ENV DEBIAN_FRONTEND=noninteractive
25+
1926
# Configure apt and install packages
2027
RUN apt-get update \
2128
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
2229
#
2330
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
2431
&& apt-get -y install git iproute2 procps lsb-release \
2532
#
33+
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
34+
&& if [ "$INSTALL_NODE" = "true" ]; then \
35+
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
36+
&& apt-get install -y nodejs; \
37+
fi \
38+
#
39+
# [Optional] Install the Azure CLI
40+
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
41+
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
42+
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
43+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
44+
&& apt-get update \
45+
&& apt-get install -y azure-cli; \
46+
fi \
47+
#
2648
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
2749
&& groupadd --gid $USER_GID $USERNAME \
2850
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
@@ -37,4 +59,4 @@ RUN apt-get update \
3759
&& rm -rf /var/lib/apt/lists/*
3860

3961
# Switch back to dialog for any ad-hoc use of apt-get
40-
ENV DEBIAN_FRONTEND=
62+
ENV DEBIAN_FRONTEND=

containers/dotnetcore-2.1/README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,26 @@
1212

1313
## Using this definition with an existing folder
1414

15-
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
15+
A few notes on this definition:
1616

17-
```json
18-
"console": "integratedTerminal"
19-
```
17+
1. Only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
18+
19+
```json
20+
"console": "integratedTerminal"
21+
```
22+
23+
2. Given how frequently ASP.NET applications use Node.js for front end code, this container also includes Node.js. You can change the version of Node.js installed or disable its installation by updating these lines in `.devcontainer/Dockerfile`.
24+
25+
```Dockerfile
26+
ARG INSTALL_NODE="true"
27+
ARG NODE_MAJOR_VERSION="10"
28+
```
29+
30+
3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:
31+
32+
```Dockerfile
33+
ARG INSTALL_AZURE_CLI="true"
34+
```
2035

2136
Beyond that, just follow these steps to use the definition:
2237

containers/dotnetcore-2.2/.devcontainer/Dockerfile

+27-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,46 @@
55

66
FROM mcr.microsoft.com/dotnet/core/sdk:2.2
77

8-
# Avoid warnings by switching to noninteractive
9-
ENV DEBIAN_FRONTEND=noninteractive
10-
11-
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
8+
## This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
129
# this user's GID/UID must match your local user UID/GID to avoid permission issues
1310
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
1411
# https://aka.ms/vscode-remote/containers/non-root-user for details.
1512
ARG USERNAME=vscode
1613
ARG USER_UID=1000
1714
ARG USER_GID=$USER_UID
1815

16+
# [Optional] Version of Node.js to install.
17+
ARG INSTALL_NODE="true"
18+
ARG NODE_MAJOR_VERSION="10"
19+
20+
# [Optional] Install the Azure CLI
21+
ARG INSTALL_AZURE_CLI="false"
22+
23+
# Avoid warnings by switching to noninteractive
24+
ENV DEBIAN_FRONTEND=noninteractive
25+
1926
# Configure apt and install packages
2027
RUN apt-get update \
2128
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
2229
#
2330
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
2431
&& apt-get -y install git iproute2 procps lsb-release \
2532
#
33+
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
34+
&& if [ "$INSTALL_NODE" = "true" ]; then \
35+
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
36+
&& apt-get install -y nodejs; \
37+
fi \
38+
#
39+
# [Optional] Install the Azure CLI
40+
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
41+
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
42+
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
43+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
44+
&& apt-get update \
45+
&& apt-get install -y azure-cli; \
46+
fi \
47+
#
2648
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
2749
&& groupadd --gid $USER_GID $USERNAME \
2850
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
@@ -37,4 +59,4 @@ RUN apt-get update \
3759
&& rm -rf /var/lib/apt/lists/*
3860

3961
# Switch back to dialog for any ad-hoc use of apt-get
40-
ENV DEBIAN_FRONTEND=
62+
ENV DEBIAN_FRONTEND=

containers/dotnetcore-2.2/README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,26 @@
1212

1313
## Using this definition with an existing folder
1414

15-
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
15+
A few notes on this definition:
1616

17-
```json
18-
"console": "integratedTerminal"
19-
```
17+
1. Only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
18+
19+
```json
20+
"console": "integratedTerminal"
21+
```
22+
23+
2. Given how frequently ASP.NET applications use Node.js for front end code, this container also includes Node.js. You can change the version of Node.js installed or disable its installation by updating these lines in `.devcontainer/Dockerfile`.
24+
25+
```Dockerfile
26+
ARG INSTALL_NODE="true"
27+
ARG NODE_MAJOR_VERSION="10"
28+
```
29+
30+
3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:
31+
32+
```Dockerfile
33+
ARG INSTALL_AZURE_CLI="true"
34+
```
2035

2136
Beyond that, just follow these steps to use the definition:
2237

containers/dotnetcore-latest/.devcontainer/Dockerfile

+26-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
FROM mcr.microsoft.com/dotnet/core/sdk:latest
77

8-
# Avoid warnings by switching to noninteractive
9-
ENV DEBIAN_FRONTEND=noninteractive
10-
118
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
129
# this user's GID/UID must match your local user UID/GID to avoid permission issues
1310
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
@@ -16,13 +13,38 @@ ARG USERNAME=vscode
1613
ARG USER_UID=1000
1714
ARG USER_GID=$USER_UID
1815

16+
# [Optional] Version of Node.js to install.
17+
ARG INSTALL_NODE="true"
18+
ARG NODE_MAJOR_VERSION="10"
19+
20+
# [Optional] Install the Azure CLI
21+
ARG INSTALL_AZURE_CLI="false"
22+
23+
# Avoid warnings by switching to noninteractive
24+
ENV DEBIAN_FRONTEND=noninteractive
25+
1926
# Configure apt and install packages
2027
RUN apt-get update \
2128
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
2229
#
2330
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
2431
&& apt-get -y install git iproute2 procps lsb-release \
2532
#
33+
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
34+
&& if [ "$INSTALL_NODE" = "true" ]; then \
35+
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
36+
&& apt-get install -y nodejs; \
37+
fi \
38+
#
39+
# [Optional] Install the Azure CLI
40+
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
41+
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
42+
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
43+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
44+
&& apt-get update \
45+
&& apt-get install -y azure-cli; \
46+
fi \
47+
#
2648
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
2749
&& groupadd --gid $USER_GID $USERNAME \
2850
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
@@ -37,4 +59,4 @@ RUN apt-get update \
3759
&& rm -rf /var/lib/apt/lists/*
3860

3961
# Switch back to dialog for any ad-hoc use of apt-get
40-
ENV DEBIAN_FRONTEND=
62+
ENV DEBIAN_FRONTEND=

containers/dotnetcore-latest/README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,26 @@
1212

1313
## Using this definition with an existing folder
1414

15-
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
15+
A few notes on this definition:
1616

17-
```json
18-
"console": "integratedTerminal"
19-
```
17+
1. Only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
18+
19+
```json
20+
"console": "integratedTerminal"
21+
```
22+
23+
2. Given how frequently ASP.NET applications use Node.js for front end code, this container also includes Node.js. You can change the version of Node.js installed or disable its installation by updating these lines in `.devcontainer/Dockerfile`.
24+
25+
```Dockerfile
26+
ARG INSTALL_NODE="true"
27+
ARG NODE_MAJOR_VERSION="10"
28+
```
29+
30+
3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:
31+
32+
```Dockerfile
33+
ARG INSTALL_AZURE_CLI="true"
34+
```
2035

2136
Beyond that, just follow these steps to use the definition:
2237

0 commit comments

Comments
 (0)