From faf92156122d9def015665cdc415824b5d6e27a0 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Thu, 18 Jul 2019 09:06:53 +0100 Subject: [PATCH 1/6] Add devcontainer support for building in container --- .devcontainer/Dockerfile | 39 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 14 ++++++++++++ 2 files changed, 53 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..8e6ee5db7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,39 @@ +#------------------------------------------------------------------------------------------------------------- +# 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.1.602 + +# 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/* + +# Install PowerShell +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 + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog + +SHELL ["/usr/bin/pwsh", "-Command"] + +# Install PowerShell modules required for building and testing +RUN Install-Module InvokeBuild -Force; Install-Module Pester -Force +RUN Install-Module platyPS -Force; Install-Module Pester -Force +RUN Install-Module Pester -Force; Install-Module Pester -Force diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..105e966d4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,14 @@ +// See https://aka.ms/vscode-remote/devcontainer.json for format details. +{ + "name": "C# (.NET Core 2.1) and PowerShell on Debian 9", + "dockerFile": "Dockerfile", + + "postCreateCommand": "dotnet restore", + + "extensions": [ + "ms-vscode.csharp", + "ms-vscode.powershell", + "davidanson.vscode-markdownlint", + "editorconfig.editorconfig" + ] +} From 7f7d83c5f7672b9ddacb6280945e23ea05646ded Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Fri, 26 Jul 2019 22:34:14 +0100 Subject: [PATCH 2/6] Inline apt-get statements and remove redundant Pester installs --- .devcontainer/Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8e6ee5db7..d67565d24 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -9,12 +9,16 @@ FROM mcr.microsoft.com/dotnet/core/sdk:2.1.602 ENV DEBIAN_FRONTEND=noninteractive # Configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils 2>&1 \ +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 \ - # + # Install PowerShell + && 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 # Clean up && apt-get autoremove -y \ && apt-get clean -y \ @@ -34,6 +38,6 @@ ENV DEBIAN_FRONTEND=dialog SHELL ["/usr/bin/pwsh", "-Command"] # Install PowerShell modules required for building and testing -RUN Install-Module InvokeBuild -Force; Install-Module Pester -Force -RUN Install-Module platyPS -Force; Install-Module Pester -Force -RUN Install-Module Pester -Force; Install-Module Pester -Force +RUN Install-Module InvokeBuild -Force +RUN Install-Module platyPS -Force +RUN Install-Module Pester -Force From d3398f623516843fb715362c76a6f6525285ed99 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Fri, 26 Jul 2019 22:37:42 +0100 Subject: [PATCH 3/6] fix syntax --- .devcontainer/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d67565d24..2d5232ad3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,7 +10,6 @@ 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 \ # Install PowerShell @@ -18,7 +17,7 @@ RUN apt-get update && apt-get -y install --no-install-recommends apt-utils 2>&1 && 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 + && apt-get install -y powershell \ # Clean up && apt-get autoremove -y \ && apt-get clean -y \ From d56291789ac659858bdd8d9efab7b871e18e5870 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Fri, 26 Jul 2019 22:47:50 +0100 Subject: [PATCH 4/6] final cleanup --- .devcontainer/Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2d5232ad3..567c17399 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -23,14 +23,6 @@ RUN apt-get update && apt-get -y install --no-install-recommends apt-utils 2>&1 && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -# Install PowerShell -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 - # Switch back to dialog for any ad-hoc use of apt-get ENV DEBIAN_FRONTEND=dialog From a6ad5de96107a3fb3ba059240ae8979cc1947b32 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Wed, 20 Nov 2019 09:18:59 +0000 Subject: [PATCH 5/6] Update .devcontainer/devcontainer.json Co-Authored-By: Tyler James Leonhardt --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 105e966d4..fb3a9dd0f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "extensions": [ "ms-vscode.csharp", - "ms-vscode.powershell", + "ms-vscode.powershell-preview", "davidanson.vscode-markdownlint", "editorconfig.editorconfig" ] From 3745ae79e6954def655877a29a1418d54834049f Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Wed, 20 Nov 2019 09:20:12 +0000 Subject: [PATCH 6/6] Update .devcontainer/Dockerfile --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 567c17399..6aadb3186 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/dotnet/core/sdk:2.1.602 +FROM mcr.microsoft.com/dotnet/core/sdk:2.1.802 # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive