Skip to content

Commit

Permalink
Add devcontainer settings (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo authored Jul 16, 2024
1 parent abdc99e commit c07fef6
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# [Choice] .NET version: 8.0, 8.0-bookworm-slim, 8.0-jammy
ARG VARIANT="8.0-noble"
FROM mcr.microsoft.com/dotnet/sdk:${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
117 changes: 117 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"name": "DevContainer for .NET",
"build": {
"dockerfile": "./Dockerfile",
"context": ".",
"args": {
"VARIANT": "8.0-noble"
}
},

"features": {
// Uncomment the below to install .NET SDK
"ghcr.io/devcontainers/features/dotnet:latest": {
"version": "6.0",
"additionalVersions": "7.0"
},

// Uncomment the below to install Azure CLI
"ghcr.io/devcontainers/features/azure-cli:latest": {
"version": "latest",
"extensions": "account,alias,containerapp,deploy-to-azure,subscription"
},

// Uncomment the below to install GitHub CLI
"ghcr.io/devcontainers/features/github-cli:latest": {
"version": "latest"
},

// Uncomment the below to install node.js
"ghcr.io/devcontainers/features/node:latest": {
"version": "lts",
"nodeGypDependencies": true,
"nvmInstallPath": "/usr/local/share/nvm"
},

// Uncomment the below to install Docker-in-Docker
"ghcr.io/devcontainers/features/docker-in-docker:latest": {},

// Uncomment the below to install Kubernetes CLI
"ghcr.io/devcontainers/features/kubectl-helm-minikube:latest": {},

// Install common utilities
"ghcr.io/devcontainers/features/common-utils:latest": {
"installZsh": true,
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"installOhMyZshConfig": true,
"upgradePackages": true,
"username": "vscode",
"uid": "1000",
"gid": "1000"
}
},

"overrideFeatureInstallOrder": [
"ghcr.io/devcontainers/features/common-utils"
],

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
// Recommended extensions - GitHub
"GitHub.vscode-github-actions",
"GitHub.vscode-pull-request-github",

// Recommended extensions - Azure
"ms-azuretools.vscode-bicep",

// Recommended extensions - Collaboration
"EditorConfig.EditorConfig",
"streetsidesoftware.code-spell-checker",

// Recommended extensions - Markdown
"bierner.github-markdown-preview",
"DavidAnson.vscode-markdownlint",
"docsmsft.docs-linting",
"johnpapa.read-time",
"yzhang.markdown-all-in-one",

// Required extensions
"GitHub.copilot",
"GitHub.copilot-chat",
"ms-dotnettools.csdevkit",
"ms-vscode.PowerShell",
"ms-vscode.vscode-node-azure-pack",
"VisualStudioExptTeam.vscodeintellicode"
],
"settings": {
// Uncomment if you want to disable the minimap view
"editor.minimap.enabled": false,

// Uncomment if you want to change the default font family to D2Coding
"editor.fontFamily": "D2Coding, Consolas, 'Courier New', monospace",

// Uncomment if you want to use D2CodingLigature Nerd Font as the default terminal font
"terminal.integrated.fontFamily": "D2CodingLigature Nerd Font",

// Recommended settings for the explorer pane
"explorer.sortOrder": "type",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.bicep": "${capture}.json, ${capture}.parameters.json",
"*.razor": "${capture}.razor.css, ${capture}.razor.cs",
"*.js": "${capture}.js.map"
}
}
}
},

// Uncomment if you want to use bash in 'onCreateCommand' after the container is created
"onCreateCommand": "/bin/bash ./.devcontainer/on-create.sh > ~/on-create.log",

"remoteUser": "vscode"
}
41 changes: 41 additions & 0 deletions .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Install additional apt packages
sudo apt-get update \
&& sudo apt-get install -y dos2unix libsecret-1-0 xdg-utils fonts-naver-d2coding \
&& sudo apt-get clean -y && sudo rm -rf /var/lib/apt/lists/*

## Configure git
git config --global pull.rebase false
git config --global core.autocrlf input

## Install dev certs
dotnet tool update -g linux-dev-certs
dotnet linux-dev-certs install

## Add .NET Aspire workload
sudo dotnet workload update && sudo dotnet workload install aspire

# D2Coding Nerd Font
# Uncomment the below to install the D2Coding Nerd Font
mkdir $HOME/.local
mkdir $HOME/.local/share
mkdir $HOME/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/D2Coding.zip
unzip D2Coding.zip -d $HOME/.local/share/fonts
rm D2Coding.zip

## AZURE BICEP CLI ##
# Uncomment the below to install Azure Bicep CLI.
az bicep install

## GitHub Copilot CLI ##
# Uncomment the below to install Azure Bicep CLI.
gh extension install github/gh-copilot

## AZURE DEV CLI ##
# Uncomment the below to install Azure Dev CLI. Make sure you have installed Azure CLI and GitHub CLI
curl -fsSL https://aka.ms/install-azd.sh | bash

## OH-MY-POSH ##
# Uncomment the below to install oh-my-posh
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh

0 comments on commit c07fef6

Please sign in to comment.