Skip to content

Commit 085548f

Browse files
bergmeisterTylerLeonhardt
authored andcommitted
Add devcontainer support for building in container (#993)
* Add devcontainer support for building in container * Inline apt-get statements and remove redundant Pester installs * fix syntax * final cleanup * Update .devcontainer/devcontainer.json Co-Authored-By: Tyler James Leonhardt <[email protected]> * Update .devcontainer/Dockerfile
1 parent c6b4535 commit 085548f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.devcontainer/Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.802
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Configure apt and install packages
12+
RUN apt-get update && apt-get -y install --no-install-recommends apt-utils 2>&1 \
13+
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
14+
&& apt-get -y install git procps lsb-release \
15+
# Install PowerShell
16+
&& apt-get install curl gnupg apt-transport-https -y \
17+
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
18+
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list \
19+
&& apt-get update \
20+
&& apt-get install -y powershell \
21+
# Clean up
22+
&& apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Switch back to dialog for any ad-hoc use of apt-get
27+
ENV DEBIAN_FRONTEND=dialog
28+
29+
SHELL ["/usr/bin/pwsh", "-Command"]
30+
31+
# Install PowerShell modules required for building and testing
32+
RUN Install-Module InvokeBuild -Force
33+
RUN Install-Module platyPS -Force
34+
RUN Install-Module Pester -Force

.devcontainer/devcontainer.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
2+
{
3+
"name": "C# (.NET Core 2.1) and PowerShell on Debian 9",
4+
"dockerFile": "Dockerfile",
5+
6+
"postCreateCommand": "dotnet restore",
7+
8+
"extensions": [
9+
"ms-vscode.csharp",
10+
"ms-vscode.powershell-preview",
11+
"davidanson.vscode-markdownlint",
12+
"editorconfig.editorconfig"
13+
]
14+
}

0 commit comments

Comments
 (0)