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

Commit

Permalink
Merge pull request #138 from microsoft/dotnet-node-azure
Browse files Browse the repository at this point in the history
Enable optional installation of Node and the Azure CLI
  • Loading branch information
Chuxel authored Oct 30, 2019
2 parents 2877b82 + 487e3fa commit d52e7d4
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 25 deletions.
30 changes: 26 additions & 4 deletions containers/dotnetcore-2.1/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

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

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
Expand All @@ -16,13 +13,38 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# [Optional] Version of Node.js to install.
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"

# [Optional] Install the Azure CLI
ARG INSTALL_AZURE_CLI="false"

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
#
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
&& if [ "$INSTALL_NODE" = "true" ]; then \
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
&& apt-get install -y nodejs; \
fi \
#
# [Optional] Install the Azure CLI
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& apt-get update \
&& apt-get install -y azure-cli; \
fi \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
Expand All @@ -37,4 +59,4 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
ENV DEBIAN_FRONTEND=
23 changes: 19 additions & 4 deletions containers/dotnetcore-2.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,26 @@

## Using this definition with an existing folder

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.
A few notes on this definition:

```json
"console": "integratedTerminal"
```
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.

```json
"console": "integratedTerminal"
```

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`.

```Dockerfile
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"
```

3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:

```Dockerfile
ARG INSTALL_AZURE_CLI="true"
```

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

Expand Down
32 changes: 27 additions & 5 deletions containers/dotnetcore-2.2/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,46 @@

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

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
## This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
# https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# [Optional] Version of Node.js to install.
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"

# [Optional] Install the Azure CLI
ARG INSTALL_AZURE_CLI="false"

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
#
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
&& if [ "$INSTALL_NODE" = "true" ]; then \
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
&& apt-get install -y nodejs; \
fi \
#
# [Optional] Install the Azure CLI
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& apt-get update \
&& apt-get install -y azure-cli; \
fi \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
Expand All @@ -37,4 +59,4 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
ENV DEBIAN_FRONTEND=
23 changes: 19 additions & 4 deletions containers/dotnetcore-2.2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,26 @@

## Using this definition with an existing folder

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.
A few notes on this definition:

```json
"console": "integratedTerminal"
```
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.

```json
"console": "integratedTerminal"
```

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`.

```Dockerfile
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"
```

3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:

```Dockerfile
ARG INSTALL_AZURE_CLI="true"
```

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

Expand Down
30 changes: 26 additions & 4 deletions containers/dotnetcore-latest/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

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

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
Expand All @@ -16,13 +13,38 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# [Optional] Version of Node.js to install.
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"

# [Optional] Install the Azure CLI
ARG INSTALL_AZURE_CLI="false"

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
#
# [Optional] Install Node.js for ASP.NET Core Web Applicationss
&& if [ "$INSTALL_NODE" = "true" ]; then \
curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR_VERSION.x | bash - \
&& apt-get install -y nodejs; \
fi \
#
# [Optional] Install the Azure CLI
&& if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& apt-get update \
&& apt-get install -y azure-cli; \
fi \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
Expand All @@ -37,4 +59,4 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
ENV DEBIAN_FRONTEND=
23 changes: 19 additions & 4 deletions containers/dotnetcore-latest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,26 @@

## Using this definition with an existing folder

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.
A few notes on this definition:

```json
"console": "integratedTerminal"
```
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.

```json
"console": "integratedTerminal"
```

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`.

```Dockerfile
ARG INSTALL_NODE="true"
ARG NODE_MAJOR_VERSION="10"
```

3. If you would like to install the Azure CLI update this line in `.devcontainer/Dockerfile`:

```Dockerfile
ARG INSTALL_AZURE_CLI="true"
```

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

Expand Down

0 comments on commit d52e7d4

Please sign in to comment.