Skip to content

Commit 0ff482d

Browse files
authored
Dev Container (#10751)
1 parent da79940 commit 0ff482d

File tree

4 files changed

+130
-25
lines changed

4 files changed

+130
-25
lines changed

.devcontainer/Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0
2+
3+
ARG DOTNET_SDK_INSTALL_URL=https://dot.net/v1/dotnet-install.sh
4+
# Install the correct Roslyn SDK into the same directory that the base image installs the SDK in.
5+
ENV DOTNET_INSTALL_DIR=/usr/share/dotnet
6+
7+
# Copy the global.json file so its available in the image before the repo is cloned
8+
COPY global.json /tmp/
9+
10+
RUN cd /tmp \
11+
&& curl --location --output dotnet-install.sh "${DOTNET_SDK_INSTALL_URL}" \
12+
&& chmod +x dotnet-install.sh \
13+
&& mkdir -p "${DOTNET_INSTALL_DIR}" \
14+
&& ./dotnet-install.sh --jsonfile "./global.json" --install-dir "${DOTNET_INSTALL_DIR}" \
15+
&& rm dotnet-install.sh
16+
17+
# Set up machine requirements to build the repo
18+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
19+
&& apt-get -y install --no-install-recommends curl git

.devcontainer/devcontainer.json

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.140.1/containers/dotnetcore
3+
{
4+
"name": "Razor DevContainer",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Set the context to the workspace folder to allow us to copy files from it.
8+
"context": ".."
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"settings": {
13+
"files.associations": {
14+
"*.csproj": "msbuild",
15+
"*.fsproj": "msbuild",
16+
"*.globalconfig": "ini",
17+
"*.manifest": "xml",
18+
"*.nuspec": "xml",
19+
"*.pkgdef": "ini",
20+
"*.projitems": "msbuild",
21+
"*.props": "msbuild",
22+
"*.resx": "xml",
23+
"*.rsp": "Powershell",
24+
"*.ruleset": "xml",
25+
"*.settings": "xml",
26+
"*.shproj": "msbuild",
27+
"*.slnf": "json",
28+
"*.targets": "msbuild",
29+
"*.vbproj": "msbuild",
30+
"*.vsixmanifest": "xml",
31+
"*.vstemplate": "xml",
32+
"*.xlf": "xml",
33+
"*.yml": "azure-pipelines"
34+
},
35+
// ms-dotnettools.csharp settings
36+
"omnisharp.disableMSBuildDiagnosticWarning": true,
37+
"omnisharp.enableEditorConfigSupport": true,
38+
"omnisharp.enableImportCompletion": true,
39+
"omnisharp.useModernNet": true,
40+
"omnisharp.enableAsyncCompletion": true,
41+
// ms-dotnettools.csdevkit settings
42+
"dotnet.defaultSolution": "Razor.sln",
43+
// ms-vscode.powershell settings
44+
"powershell.promptToUpdatePowerShell": false,
45+
"powershell.integratedConsole.showOnStartup": false,
46+
"powershell.startAutomatically": false,
47+
// ms-azure-devops.azure-pipelines settings
48+
},
49+
"extensions": [
50+
"ms-dotnettools.csharp",
51+
"ms-dotnettools.csdevkit",
52+
"EditorConfig.EditorConfig",
53+
"ms-vscode.powershell",
54+
"tintoy.msbuild-project-tools",
55+
"ms-azure-devops.azure-pipelines"
56+
]
57+
}
58+
},
59+
"postCreateCommand": "${containerWorkspaceFolder}/restore.sh"
60+
}

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
},
1616
"dotnet.defaultSolution": "Razor.sln",
1717
"omnisharp.defaultLaunchSolution": "Razor.sln",
18-
"files.encoding": "utf8bom"
18+
"files.encoding": "utf8bom",
19+
"dotnet.testWindow.disableBuildOnRefresh": true
1920
}

.vscode/tasks.json

+49-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,52 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"label": "ActivateDotnet",
6-
"type": "shell",
7-
"windows": {
8-
"command": "echo",
9-
"args": [
10-
"Skipping activation on windows"
11-
]
12-
},
13-
"linux": {
14-
"command": "source",
15-
"args": [
16-
"activate.sh"
17-
],
18-
"options": {
19-
"cwd": "${workspaceFolder}"
20-
},
21-
"presentation": {
22-
"reveal": "silent"
23-
}
24-
},
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "ActivateDotnet",
6+
"type": "shell",
7+
"windows": {
8+
"command": "echo",
9+
"args": [
10+
"Skipping activation on windows"
11+
]
12+
},
13+
"linux": {
14+
"command": "source",
15+
"args": [
16+
"activate.sh"
17+
],
18+
"options": {
19+
"cwd": "${workspaceFolder}"
2520
},
26-
]
21+
"presentation": {
22+
"reveal": "silent"
23+
}
24+
},
25+
},
26+
{
27+
"label": "build.sh",
28+
"command": "./build.sh",
29+
"type": "shell",
30+
"args": [
31+
],
32+
"windows": {
33+
"command": "${workspaceFolder}/build.cmd",
34+
},
35+
"problemMatcher": "$msCompile",
36+
"group": "build"
37+
},
38+
{
39+
"label": "build Rasor.Slim.slnf",
40+
"command": "dotnet",
41+
"type": "shell",
42+
"args": [
43+
"build",
44+
"-p:RunAnalyzersDuringBuild=false",
45+
"-p:GenerateFullPaths=true",
46+
"Razor.Slim.slnf"
47+
],
48+
"problemMatcher": "$msCompile",
49+
"group": "build"
50+
}
51+
]
2752
}

0 commit comments

Comments
 (0)