diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..d953074c212a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +# Dockerfile for Azure PowerShell devcontainer +# Use official .NET 8.0 image for amd64 architecture +FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/dotnet:1-8.0 + +# Set working directory +WORKDIR /workspace + +# Set default user to root for pwsh compatibility +USER root diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 74889d044fba..0dbf44ab5dad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,8 +2,11 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { "name": "C# (.NET)", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0", + // Use a Dockerfile for custom configuration + + "context": "..", + + "dockerFile": "Dockerfile", // Features to add to the dev container. More info: https://containers.dev/features. "features": { @@ -15,16 +18,8 @@ } }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [5000, 5001], - // "portsAttributes": { - // "5001": { - // "protocol": "https" - // } - // } - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm install -g autorest", + "postCreateCommand": "./.devcontainer/post-create.sh", // Configure tool-specific properties. "customizations": { diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 000000000000..24092f22a30d --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +echo "� Updating npm..." +npm update -g npm + +echo "�📦 Installing AutoRest..." +npm install -g autorest + +echo "⚡ Installing platyPS..." +pwsh -c "Install-Module -Name platyPS -Force -Scope CurrentUser" + +echo "🔐 Installing Az.Accounts for authentication..." +pwsh -c "Install-Module -Name Az.Accounts -Force -Scope CurrentUser" + +echo "🧪 Installing PSScriptAnalyzer for static analysis..." +pwsh -c "Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser" +