From 4f1fd98393d97bbdfe36e459ccb11322a294e9d3 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Wed, 10 Jul 2019 18:21:11 +0100 Subject: [PATCH 1/5] Add DevContainer support --- .devcontainer/Dockerfile | 35 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 12 +++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..fd381d976 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,35 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +FROM mcr.microsoft.com/dotnet/core/sdk:2.2.104 + +# 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 2>&1 \ + # + # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed + && apt-get -y install git procps lsb-release \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update \ + && apt-get install curl gnupg apt-transport-https -y \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list \ + && apt-get update \ + && apt-get install -y powershell + +RUN pwsh -c Install-Module platyPS -Force; Install-Module Pester -Force + +#ENV PATH="/root/.dotnet:${PATH}" + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..a728d13bf --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +// See https://aka.ms/vscode-remote/devcontainer.json for format details. +{ + "name": "C# (.NET Core 2.2) and PowerShell Core with platyPS and Pester", + "dockerFile": "Dockerfile", + + "postCreateCommand": "dotnet restore" + + "extensions": [ + "ms-vscode.csharp", + "ms-vscode.powershell" + ] +} \ No newline at end of file From 1d5956254c69818fd46424a3cb3edc7722701962 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Wed, 10 Jul 2019 18:26:38 +0100 Subject: [PATCH 2/5] add recommended extension --- .vscode/extensions.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0f6388008..9be92f563 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ // for the documentation about the extensions.json format "recommendations": [ "ms-vscode.PowerShell", - "ms-vscode.csharp" + "ms-vscode.csharp", + "ms-vscode-remote.remote-containers" ] } \ No newline at end of file From 9670b1e3948c963d855df44c32502c05172de379 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Wed, 10 Jul 2019 18:29:56 +0100 Subject: [PATCH 3/5] cleanup docker file --- .devcontainer/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index fd381d976..e97a28dbd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -29,7 +29,5 @@ RUN apt-get update \ RUN pwsh -c Install-Module platyPS -Force; Install-Module Pester -Force -#ENV PATH="/root/.dotnet:${PATH}" - # Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog \ No newline at end of file +ENV DEBIAN_FRONTEND=dialog From 06f7c0cf12bcfaf65eb9843378e27a143e8cf2f5 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Thu, 11 Jul 2019 09:16:05 +0100 Subject: [PATCH 4/5] Fix json --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a728d13bf..023eee6ea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,10 +3,10 @@ "name": "C# (.NET Core 2.2) and PowerShell Core with platyPS and Pester", "dockerFile": "Dockerfile", - "postCreateCommand": "dotnet restore" + "postCreateCommand": "dotnet restore", "extensions": [ "ms-vscode.csharp", "ms-vscode.powershell" ] -} \ No newline at end of file +} From a934bba788b26bba8f659489d537cd473a4d175a Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sat, 4 Jan 2020 18:42:31 +0000 Subject: [PATCH 5/5] Update with new template (from .Net Core 3.0 but adapted for 3.1 and trimmed out unnecessary things) --- .devcontainer/Dockerfile | 22 ++++++++++------------ .devcontainer/devcontainer.json | 12 +++++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e97a28dbd..0b85b17b1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,31 +3,29 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/dotnet/core/sdk:2.2.104 +FROM mcr.microsoft.com/dotnet/core/sdk:3.1 + +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. # 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 2>&1 \ + && 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 procps lsb-release \ + && apt-get -y install git iproute2 procps apt-transport-https gnupg2 curl lsb-release \ # # Clean up && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* - -RUN apt-get update \ - && apt-get install curl gnupg apt-transport-https -y \ - && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ - && echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list \ - && apt-get update \ - && apt-get install -y powershell - -RUN pwsh -c Install-Module platyPS -Force; Install-Module Pester -Force + +RUN pwsh -c Install-Module platyPS,Pester -Force # Switch back to dialog for any ad-hoc use of apt-get ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 023eee6ea..5df5ae82d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,14 @@ -// See https://aka.ms/vscode-remote/devcontainer.json for format details. +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at +// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/dotnetcore-3.0 { - "name": "C# (.NET Core 2.2) and PowerShell Core with platyPS and Pester", + "name": "C# (.NET Core 3.1)", "dockerFile": "Dockerfile", - + "settings": { + "terminal.integrated.shell.linux": "/usr/bin/pwsh" + }, "postCreateCommand": "dotnet restore", - "extensions": [ "ms-vscode.csharp", "ms-vscode.powershell" ] -} +} \ No newline at end of file