This commit is contained in:
Justin Yoo 2022-10-17 22:07:17 +11:00 коммит произвёл GitHub
Родитель cc95f4ab4a
Коммит d276f92aea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 249 добавлений и 0 удалений

7
.devcontainer/Dockerfile Normal file
Просмотреть файл

@ -0,0 +1,7 @@
# [Choice] .NET version: 6.0-bullseye-slim, 6.0-jammy, 6.0-focal
ARG VARIANT="6.0-jammy"
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>

Просмотреть файл

@ -0,0 +1,138 @@
{
"name": "DevContainer for .NET",
"build": {
"dockerfile": "./Dockerfile",
"context": ".",
"args": {
"VARIANT": "6.0-jammy"
// Use this only if you need Razor support, until OmniSharp supports .NET 6 properly
// "VARIANT": "6.0-focal"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
// Azure Functions
7071,
// Azurite
10000, 10001, 10002
// ASP.NET Core Web/API App, Blazor App
// 5000, 5001,
// Azure Static Web Apps
// 4280
],
"features": {
// Uncomment the below to install Azure CLI
"ghcr.io/devcontainers/features/azure-cli:1": {
"version": "latest"
},
// Uncomment the below to install GitHub CLI
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "latest"
},
// Uncomment the below to install node.js
"ghcr.io/devcontainers/features/node:1": {
"version": "lts",
"nodeGypDependencies": true,
"nvmInstallPath": "/usr/local/share/nvm"
},
// Install common utilities
"ghcr.io/devcontainers/features/common-utils:1": {
"installZsh": true,
"installOhMyZsh": 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
"cschleiden.vscode-github-actions",
"GitHub.vscode-pull-request-github",
// Recommended extensions - Azure
"Azurite.azurite",
"ms-azuretools.vscode-bicep",
// Recommended extensions - Collaboration
"eamodio.gitlens",
"EditorConfig.EditorConfig",
// "MS-vsliveshare.vsliveshare-pack",
"streetsidesoftware.code-spell-checker",
// Recommended extensions - .NET
"Fudge.auto-using",
"jongrant.csharpsortusings",
"kreativ-software.csharpextensions",
// Recommended extensions - Power Platform
// "microsoft-IsvExpTools.powerplatform-vscode",
// 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",
"ms-dotnettools.csharp",
"ms-vscode.PowerShell",
"ms-vscode.vscode-node-azure-pack",
"VisualStudioExptTeam.vscodeintellicode"
],
"settings": {
// Uncomment if you want to use zsh as the default shell
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
// Uncomment if you want to use CaskaydiaCove Nerd Font as the default terminal font
"terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font",
// Uncomment if you want to disable the minimap view
"editor.minimap.enabled": false,
// Recommended settings for the explorer pane
"explorer.sortOrder": "type",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.bicep": "${capture}.json",
"*.razor": "${capture}.razor.css",
"*.js": "${capture}.js.map"
}
}
}
},
// Uncomment if you want to use bash in 'postCreateCommand' after the container is created
// "postCreateCommand": "/bin/bash ./.devcontainer/post-create.sh > ~/post-create.log",
// Uncomment if you want to use zsh in 'postCreateCommand' after the container is created
"postCreateCommand": "/usr/bin/zsh ./.devcontainer/post-create.sh > ~/post-create.log",
// Uncomment if you want to connect other than 'root'. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

104
.devcontainer/post-create.sh Executable file
Просмотреть файл

@ -0,0 +1,104 @@
## Install additional apt packages
sudo apt-get update && \
sudo apt-get install -y dos2unix
## Configure git
git config --global pull.rebase false
git config --global core.autocrlf input
## Enable local HTTPS for .NET
dotnet dev-certs https --trust
## CaskaydiaCove Nerd Font
# Uncomment the below to install the CaskaydiaCove Nerd Font
mkdir $HOME/.local
mkdir $HOME/.local/share
mkdir $HOME/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/CascadiaCode.zip
unzip CascadiaCode.zip -d $HOME/.local/share/fonts
rm CascadiaCode.zip
## AZURE CLI EXTENSIONS ##
# Uncomment the below to install Azure CLI extensions
# extensions=$(az extension list-available --query "[].name" | jq -c -r '.[]')
extensions=(account alias deploy-to-azure functionapp subscription webapp)
for extension in $extensions;
do
az extension add --name $extension
done
## AZURE BICEP CLI ##
# Uncomment the below to install Azure Bicep CLI.
az bicep install
## AZURE FUNCTIONS CORE TOOLS ##
# Uncomment the below to install Azure Functions Core Tools. Make sure you have installed node.js
npm i -g azure-functions-core-tools@4 --unsafe-perm true
## Azurite ##
# Uncomment the below to install Azurite. Make sure you have installed node.js
npm install -g azurite
## AZURE STATIC WEB APPS CLI ##
# Uncomment the below to install Azure Static Web Apps CLI. Make sure you have installed node.js
# npm install -g @azure/static-web-apps-cli
## 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
## NGROK ##
# Uncomment the below to install ngrok.
# curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
# sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
# echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
# sudo tee /etc/apt/sources.list.d/ngrok.list && \
# sudo apt update && \
# sudo apt install ngrok
## OH-MY-ZSH PLUGINS & THEMES (POWERLEVEL10K) ##
# Uncomment the below to install oh-my-zsh plugins and themes (powerlevel10k) without dotfiles integration
# git clone https://github.com/zsh-users/zsh-completions.git $HOME/.oh-my-zsh/custom/plugins/zsh-completions
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
# git clone https://github.com/zsh-users/zsh-autosuggestions.git $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
# git clone https://github.com/romkatv/powerlevel10k.git $HOME/.oh-my-zsh/custom/themes/powerlevel10k --depth=1
# ln -s $HOME/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme $HOME/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme
## OH-MY-ZSH - POWERLEVEL10K SETTINGS ##
# Uncomment the below to update the oh-my-zsh settings without dotfiles integration
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-zsh/.p10k-with-clock.zsh > $HOME/.p10k-with-clock.zsh
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-zsh/.p10k-without-clock.zsh > $HOME/.p10k-without-clock.zsh
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-zsh/switch-p10k-clock.sh > $HOME/switch-p10k-clock.sh
# chmod +x ~/switch-p10k-clock.sh
# cp $HOME/.p10k-with-clock.zsh $HOME/.p10k.zsh
# cp $HOME/.zshrc $HOME/.zshrc.bak
# echo "$(cat $HOME/.zshrc)" | awk '{gsub(/ZSH_THEME=\"codespaces\"/, "ZSH_THEME=\"powerlevel10k\"")}1' > $HOME/.zshrc.replaced && mv $HOME/.zshrc.replaced $HOME/.zshrc
# echo "$(cat $HOME/.zshrc)" | awk '{gsub(/plugins=\(git\)/, "plugins=(git zsh-completions zsh-syntax-highlighting zsh-autosuggestions)")}1' > $HOME/.zshrc.replaced && mv $HOME/.zshrc.replaced $HOME/.zshrc
# echo "
# # To customize prompt, run 'p10k configure' or edit ~/.p10k.zsh.
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# " >> $HOME/.zshrc
## 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
## OH-MY-POSH - POWERLEVEL10K SETTINGS ##
# Uncomment the below to update the oh-my-posh settings without dotfiles integration
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-posh/p10k-with-clock.omp.json > $HOME/p10k-with-clock.omp.json
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-posh/p10k-without-clock.omp.json > $HOME/p10k-without-clock.omp.json
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-posh/switch-p10k-clock.ps1 > $HOME/switch-p10k-clock.ps1
# mkdir $HOME/.config/powershell
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-posh/Microsoft.PowerShell_profile.ps1 > $HOME/.config/powershell/Microsoft.PowerShell_profile.ps1
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/oh-my-posh/Microsoft.PowerShell_profile.ps1 > $HOME/.config/powershell/Microsoft.VSCode_profile.ps1
# cp $HOME/p10k-with-clock.omp.json $HOME/p10k.omp.json
## Azure Functions - local.settings.json ##
# Uncomment the below to install local.settings.json file build without dotfiles integration
# curl https://raw.githubusercontent.com/justinyoo/devcontainers-dotnet/main/azure-functions/Build-LocalSettingsJson.ps1 > $HOME/Build-LocalSettingsJson.ps1