Skip to content

Commit

Permalink
Updates to dev container config
Browse files Browse the repository at this point in the history
  • Loading branch information
danheron committed Jan 11, 2024
1 parent eeea0f6 commit d83d866
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 101 deletions.
7 changes: 0 additions & 7 deletions .devcontainer/Dockerfile

This file was deleted.

125 changes: 40 additions & 85 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "DevContainer for MudCalendar",

"build": {
"dockerfile": "./Dockerfile",
"context": ".",
"args": {
// version: 7.0, 7.0-bullseye-slim, 7.0-jammy, 6.0, 6.0-bullseye-slim, 6.0-jammy, 6.0-focal
"VARIANT": "7.0"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
// ASP.NET Core Web/API App, Blazor App
5000, 5001
],

"features": {
// GitHub CLI
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "latest"
},

// 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": {
"codespaces": {
"repositories": {
"danheron/MudBlazor": {
"permissions": {
"contents": "write",
"pull_requests": "write"
}
},
"danheron/Heron.MudCalendar": {
"permissions": {
"contents": "write",
"pull_requests": "write"
}
}
}
},

// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp",
"fernandoescolar.vscode-solution-explorer",
"VisualStudioExptTeam.vscodeintellicode"
],
"settings": {
// 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": {
"*.js": "${capture}.js.map",
"*.razor": "${capture}.razor.cs,${capture}.razor.css"
}
}
}
},

// 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 connect other than 'root'. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
"name": "Heron.MudCalendar Dev Container",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:1-7.0-bullseye",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "latest"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
//"features": { }

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit",
"PKief.material-icon-theme"
],
"settings": {
"editor.minimap.enabled": false
}
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "/bin/bash ./.devcontainer/post-create.sh > ~/post-create.log",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "vscode"
}
22 changes: 13 additions & 9 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@
wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update && \
sudo apt install -y dotnet-sdk-6.0
sudo apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
sudo apt-get install -y dotnet-sdk-6.0 dotnet-sdk-7.0

## Configure git
git config --global core.autocrlf input

## Enable local HTTPS for .NET
dotnet dev-certs https --trust

# Set vscode user as owner of workspaces folder
sudo chown vscode /workspaces

# Clone and checkout MudBlazor mudcalendar branch and restore
gh repo clone danheron/MudBlazor /workspaces/MudBlazor
git clone https://github.com/danheron/MudBlazor /workspaces/MudBlazor
cd /workspaces/MudBlazor
git checkout mudcalendar
cd src
dotnet restore

## Restore MudCalendar
cd /workspaces/Heron.MudCalendar
dotnet restore
dotnet restore Heron.MudCalendarWithDocs.sln

# Build debug and release versions of MudCalendar
dotnet build /workspaces/Heron.MudCalendar/Heron.MudCalendar -c Debug --no-restore
Expand All @@ -30,7 +34,7 @@ dotnet build /workspaces/Heron.MudCalendar/Heron.MudCalendar -c Release --no-res
dotnet build /workspaces/MudBlazor/src/MudBlazor.Docs -c Release --no-restore

# Build MudCalendar projects
dotnet build /workspaces/Heron.MudCalendar
dotnet build /workspaces/Heron.MudCalendar/Heron.MudCalendarWithDocs.sln

## AZURE CLI EXTENSIONS ##
# Uncomment the below to install Azure CLI extensions
Expand Down Expand Up @@ -62,12 +66,12 @@ dotnet build /workspaces/Heron.MudCalendar

## 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/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
#ln -s $HOME/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme $HOME/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme

## OH-MY-POSH ##
# Uncomment the below to install oh-my-posh
Expand Down

0 comments on commit d83d866

Please sign in to comment.