diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..8dde120e64 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# Visual Studio Code image with .NET + +# NOTE: +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile + +ARG VARIANT="6.0-bullseye-slim" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} diff --git a/.devcontainer/container-build.ps1 b/.devcontainer/container-build.ps1 index 8663147632..a01331b2b6 100644 --- a/.devcontainer/container-build.ps1 +++ b/.devcontainer/container-build.ps1 @@ -5,6 +5,7 @@ # This is run during container creation. # Install Python 3 dependencies +sudo apt install python3-pip -y sudo python3 -m pip install --upgrade pip sudo python3 -m pip install wheel @@ -19,3 +20,6 @@ if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -Er if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) { Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force; } + +Import-Module ./scripts/dependencies.psm1; +Install-Dependencies -Dev; diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 50afbbf168..6def01e3b8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,27 +1,35 @@ { - "name": "PSRule for Azure dev", - "settings": { + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json", + "name": "PSRule for Azure dev", + "customizations": { + "vscode": { + "settings": { "terminal.integrated.defaultProfile.linux": "pwsh", "terminal.integrated.profiles.linux": { - "pwsh": { - "path": "/bin/pwsh" - } + "pwsh": { + "path": "/opt/microsoft/powershell/7/pwsh" + } } - }, - "extensions": [ - "ms-azure-devops.azure-pipelines", - "davidanson.vscode-markdownlint", + }, + "extensions": [ + "ms-dotnettools.csharp", "bewhite.psrule-vscode-preview", "msazurermtools.azurerm-vscode-tools", - "ms-azuretools.vscode-bicep", - "ms-dotnettools.csharp", - "eamodio.gitlens", - "github.vscode-pull-request-github", - "streetsidesoftware.code-spell-checker" - ], - "features": { - "github-cli": "latest" - }, - "onCreateCommand": "/bin/pwsh -f .devcontainer/container-build.ps1", - "postStartCommand": "/bin/pwsh -f .devcontainer/container-start.ps1" + "ms-azuretools.vscode-bicep" + ] + } + }, + "features": { + "github-cli": "latest", + "powershell": "latest" + }, + "onCreateCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1", + "postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "6.0-bullseye-slim" + } + }, + "remoteUser": "vscode" }