Skip to content

Commit c07fef6

Browse files
authored
Add devcontainer settings (#31)
1 parent abdc99e commit c07fef6

File tree

3 files changed

+165
-0
lines changed

3 files changed

+165
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# [Choice] .NET version: 8.0, 8.0-bookworm-slim, 8.0-jammy
2+
ARG VARIANT="8.0-noble"
3+
FROM mcr.microsoft.com/dotnet/sdk:${VARIANT}
4+
5+
# [Optional] Uncomment this section to install additional OS packages.
6+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
7+
# && apt-get -y install --no-install-recommends <your-package-list-here>

.devcontainer/devcontainer.json

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"name": "DevContainer for .NET",
3+
"build": {
4+
"dockerfile": "./Dockerfile",
5+
"context": ".",
6+
"args": {
7+
"VARIANT": "8.0-noble"
8+
}
9+
},
10+
11+
"features": {
12+
// Uncomment the below to install .NET SDK
13+
"ghcr.io/devcontainers/features/dotnet:latest": {
14+
"version": "6.0",
15+
"additionalVersions": "7.0"
16+
},
17+
18+
// Uncomment the below to install Azure CLI
19+
"ghcr.io/devcontainers/features/azure-cli:latest": {
20+
"version": "latest",
21+
"extensions": "account,alias,containerapp,deploy-to-azure,subscription"
22+
},
23+
24+
// Uncomment the below to install GitHub CLI
25+
"ghcr.io/devcontainers/features/github-cli:latest": {
26+
"version": "latest"
27+
},
28+
29+
// Uncomment the below to install node.js
30+
"ghcr.io/devcontainers/features/node:latest": {
31+
"version": "lts",
32+
"nodeGypDependencies": true,
33+
"nvmInstallPath": "/usr/local/share/nvm"
34+
},
35+
36+
// Uncomment the below to install Docker-in-Docker
37+
"ghcr.io/devcontainers/features/docker-in-docker:latest": {},
38+
39+
// Uncomment the below to install Kubernetes CLI
40+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:latest": {},
41+
42+
// Install common utilities
43+
"ghcr.io/devcontainers/features/common-utils:latest": {
44+
"installZsh": true,
45+
"configureZshAsDefaultShell": true,
46+
"installOhMyZsh": true,
47+
"installOhMyZshConfig": true,
48+
"upgradePackages": true,
49+
"username": "vscode",
50+
"uid": "1000",
51+
"gid": "1000"
52+
}
53+
},
54+
55+
"overrideFeatureInstallOrder": [
56+
"ghcr.io/devcontainers/features/common-utils"
57+
],
58+
59+
// Configure tool-specific properties.
60+
"customizations": {
61+
// Configure properties specific to VS Code.
62+
"vscode": {
63+
// Add the IDs of extensions you want installed when the container is created.
64+
"extensions": [
65+
// Recommended extensions - GitHub
66+
"GitHub.vscode-github-actions",
67+
"GitHub.vscode-pull-request-github",
68+
69+
// Recommended extensions - Azure
70+
"ms-azuretools.vscode-bicep",
71+
72+
// Recommended extensions - Collaboration
73+
"EditorConfig.EditorConfig",
74+
"streetsidesoftware.code-spell-checker",
75+
76+
// Recommended extensions - Markdown
77+
"bierner.github-markdown-preview",
78+
"DavidAnson.vscode-markdownlint",
79+
"docsmsft.docs-linting",
80+
"johnpapa.read-time",
81+
"yzhang.markdown-all-in-one",
82+
83+
// Required extensions
84+
"GitHub.copilot",
85+
"GitHub.copilot-chat",
86+
"ms-dotnettools.csdevkit",
87+
"ms-vscode.PowerShell",
88+
"ms-vscode.vscode-node-azure-pack",
89+
"VisualStudioExptTeam.vscodeintellicode"
90+
],
91+
"settings": {
92+
// Uncomment if you want to disable the minimap view
93+
"editor.minimap.enabled": false,
94+
95+
// Uncomment if you want to change the default font family to D2Coding
96+
"editor.fontFamily": "D2Coding, Consolas, 'Courier New', monospace",
97+
98+
// Uncomment if you want to use D2CodingLigature Nerd Font as the default terminal font
99+
"terminal.integrated.fontFamily": "D2CodingLigature Nerd Font",
100+
101+
// Recommended settings for the explorer pane
102+
"explorer.sortOrder": "type",
103+
"explorer.fileNesting.enabled": true,
104+
"explorer.fileNesting.patterns": {
105+
"*.bicep": "${capture}.json, ${capture}.parameters.json",
106+
"*.razor": "${capture}.razor.css, ${capture}.razor.cs",
107+
"*.js": "${capture}.js.map"
108+
}
109+
}
110+
}
111+
},
112+
113+
// Uncomment if you want to use bash in 'onCreateCommand' after the container is created
114+
"onCreateCommand": "/bin/bash ./.devcontainer/on-create.sh > ~/on-create.log",
115+
116+
"remoteUser": "vscode"
117+
}

.devcontainer/on-create.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Install additional apt packages
2+
sudo apt-get update \
3+
&& sudo apt-get install -y dos2unix libsecret-1-0 xdg-utils fonts-naver-d2coding \
4+
&& sudo apt-get clean -y && sudo rm -rf /var/lib/apt/lists/*
5+
6+
## Configure git
7+
git config --global pull.rebase false
8+
git config --global core.autocrlf input
9+
10+
## Install dev certs
11+
dotnet tool update -g linux-dev-certs
12+
dotnet linux-dev-certs install
13+
14+
## Add .NET Aspire workload
15+
sudo dotnet workload update && sudo dotnet workload install aspire
16+
17+
# D2Coding Nerd Font
18+
# Uncomment the below to install the D2Coding Nerd Font
19+
mkdir $HOME/.local
20+
mkdir $HOME/.local/share
21+
mkdir $HOME/.local/share/fonts
22+
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/D2Coding.zip
23+
unzip D2Coding.zip -d $HOME/.local/share/fonts
24+
rm D2Coding.zip
25+
26+
## AZURE BICEP CLI ##
27+
# Uncomment the below to install Azure Bicep CLI.
28+
az bicep install
29+
30+
## GitHub Copilot CLI ##
31+
# Uncomment the below to install Azure Bicep CLI.
32+
gh extension install github/gh-copilot
33+
34+
## AZURE DEV CLI ##
35+
# Uncomment the below to install Azure Dev CLI. Make sure you have installed Azure CLI and GitHub CLI
36+
curl -fsSL https://aka.ms/install-azd.sh | bash
37+
38+
## OH-MY-POSH ##
39+
# Uncomment the below to install oh-my-posh
40+
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
41+
sudo chmod +x /usr/local/bin/oh-my-posh

0 commit comments

Comments
 (0)