Skip to content

Commit fd885f9

Browse files
authored
Add DevContainer support (#1286)
* Add DevContainer support * add recommended extension * cleanup docker file * Fix json * Update with new template (from .Net Core 3.0 but adapted for 3.1 and trimmed out unnecessary things)
1 parent ea49400 commit fd885f9

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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:3.1
7+
8+
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
9+
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
10+
# will be updated to match your local UID/GID (when using the dockerFile property).
11+
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
12+
13+
# Avoid warnings by switching to noninteractive
14+
ENV DEBIAN_FRONTEND=noninteractive
15+
16+
# Configure apt and install packages
17+
RUN apt-get update \
18+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
19+
#
20+
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
21+
&& apt-get -y install git iproute2 procps apt-transport-https gnupg2 curl lsb-release \
22+
#
23+
# Clean up
24+
&& apt-get autoremove -y \
25+
&& apt-get clean -y \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
RUN pwsh -c Install-Module platyPS,Pester -Force
29+
30+
# Switch back to dialog for any ad-hoc use of apt-get
31+
ENV DEBIAN_FRONTEND=dialog

.devcontainer/devcontainer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
2+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/dotnetcore-3.0
3+
{
4+
"name": "C# (.NET Core 3.1)",
5+
"dockerFile": "Dockerfile",
6+
"settings": {
7+
"terminal.integrated.shell.linux": "/usr/bin/pwsh"
8+
},
9+
"postCreateCommand": "dotnet restore",
10+
"extensions": [
11+
"ms-vscode.csharp",
12+
"ms-vscode.powershell"
13+
]
14+
}

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"ms-vscode.PowerShell",
6-
"ms-vscode.csharp"
6+
"ms-vscode.csharp",
7+
"ms-vscode-remote.remote-containers"
78
]
89
}

0 commit comments

Comments
 (0)