Skip to content

Commit 4a3b481

Browse files
authored
Migrate demo app to .NET 6 (#31)
* Migrate demo app to .NET 6 Fixes #30 * Add VS Code support * Resolve bamurtaugh comments - Update documentation to point to the new devcontainer org - Add settings and ports mappings to devcontainer - Remove .NET "core" mention * docs: Update source reference of base image
1 parent 2d736c9 commit 4a3b481

14 files changed

+334
-384
lines changed

.devcontainer/Dockerfile

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.0/containers/dotnetcore/.devcontainer/base.Dockerfile
1+
# See here for image contents: https://github.com/devcontainers/images/blob/main/src/dotnet/.devcontainer/Dockerfile
22

3-
# [Choice] .NET Core version: 5.0, 3.1, 2.1
4-
ARG VARIANT="3.1"
5-
FROM mcr.microsoft.com/devcontainers/dotnetcore:0-${VARIANT}
3+
# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal
4+
ARG VARIANT="6.0-bullseye-slim"
5+
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}
66

7-
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
7+
# [Choice] Node.js version: none, lts/*, 18, 16, 14
88
ARG NODE_VERSION="none"
99
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
1010

11-
# [Option] Install Azure CLI
12-
ARG INSTALL_AZURE_CLI="false"
13-
COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
14-
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
15-
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
16-
1711
# [Optional] Uncomment this section to install additional OS packages.
1812
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1913
# && apt-get -y install --no-install-recommends <your-package-list-here>
2014

2115
# [Optional] Uncomment this line to install global node packages.
22-
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
16+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 67 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,67 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.0/containers/dotnetcore
3-
{
4-
"name": "C# Sample",
5-
"build": {
6-
"dockerfile": "Dockerfile",
7-
"args": {
8-
// Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0
9-
"VARIANT": "3.1",
10-
"NODE_VERSION": "lts/*",
11-
"INSTALL_AZURE_CLI": "false"
12-
}
13-
},
14-
15-
// Configure tool-specific properties.
16-
"customizations": {
17-
// Configure properties specific to VS Code.
18-
"vscode": {
19-
// Set *default* container specific settings.json values on container create.
20-
"settings": {},
21-
22-
// Add the IDs of extensions you want installed when the container is created.
23-
"extensions": [
24-
"ms-dotnettools.csharp"
25-
]
26-
}
27-
},
28-
29-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
30-
// "forwardPorts": [5000, 5001],
31-
32-
// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
33-
"portsAttributes": {
34-
"5000": {
35-
"label": "Hello Remote World",
36-
"onAutoForward": "notify"
37-
}
38-
},
39-
40-
// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
41-
// "otherPortsAttributes": {
42-
// "onAutoForward": "silent"
43-
// },
44-
45-
// [Optional] To reuse of your local HTTPS dev cert:
46-
//
47-
// 1. Export it locally using this command:
48-
// * Windows PowerShell:
49-
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
50-
// * macOS/Linux terminal:
51-
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
52-
//
53-
// 2. Uncomment these 'remoteEnv' lines:
54-
// "remoteEnv": {
55-
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
56-
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
57-
// },
58-
//
59-
// 3. Do one of the following depending on your scenario:
60-
// * When using GitHub Codespaces and/or Remote - Containers:
61-
// 1. Start the container
62-
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
63-
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
64-
//
65-
// * If only using Remote - Containers with a local container, uncomment this line instead:
66-
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
67-
68-
// Use 'postCreateCommand' to run commands after the container is created.
69-
// "postCreateCommand": "dotnet restore",
70-
71-
// Comment this out to connect as a root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
72-
"remoteUser": "vscode"
73-
}
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/devcontainers/templates/tree/main/src/dotnet
3+
4+
{
5+
"name": "C# (.NET) Sample",
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"args": {
9+
// Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0
10+
// Append -bullseye or -focal to pin to an OS version.
11+
"VARIANT": "6.0-bullseye",
12+
// Options
13+
"NODE_VERSION": "none"
14+
}
15+
},
16+
// Set *default* container specific settings.json values on container create.
17+
"settings": {},
18+
// Sets the ports that will be mapped to localhost or Codespaces.
19+
"portsAttributes": {
20+
"3000": {
21+
"label": "Hello Remote World",
22+
"onAutoForward": "notify"
23+
}
24+
},
25+
// Configure tool-specific properties.
26+
"customizations": {
27+
// Configure properties specific to VS Code.
28+
"vscode": {
29+
// Add the IDs of extensions you want installed when the container is created.
30+
"extensions": [
31+
"ms-dotnettools.csharp"
32+
]
33+
}
34+
},
35+
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
// "forwardPorts": [5000, 5001],
38+
39+
// [Optional] To reuse of your local HTTPS dev cert:
40+
//
41+
// 1. Export it locally using this command:
42+
// * Windows PowerShell:
43+
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
44+
// * macOS/Linux terminal:
45+
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
46+
//
47+
// 2. Uncomment these 'remoteEnv' lines:
48+
// "remoteEnv": {
49+
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
50+
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
51+
// },
52+
//
53+
// 3. Do one of the following depending on your scenario:
54+
// * When using GitHub Codespaces and/or Remote - Containers:
55+
// 1. Start the container
56+
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
57+
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
58+
//
59+
// * If only using Remote - Containers with a local container, uncomment this line instead:
60+
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
61+
62+
// Use 'postCreateCommand' to run commands after the container is created.
63+
// "postCreateCommand": "dotnet restore",
64+
65+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
66+
"remoteUser": "vscode"
67+
}

.devcontainer/library-scripts/azcli-debian.sh

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)