From 1b390d31288fc97b636100164f5964cd05591982 Mon Sep 17 00:00:00 2001 From: Ren Silva Date: Thu, 27 Nov 2025 09:45:02 +1100 Subject: [PATCH 1/3] corrected devcontainer to work on arm64 computers --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/devcontainer.json | 17 ++++++----------- .devcontainer/post-create.sh | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100755 .devcontainer/post-create.sh 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..a49bfc740990 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,14 @@ +#!/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" \ No newline at end of file From d2a85293778aa3a81f0d070cab44b4f79e6d49fa Mon Sep 17 00:00:00 2001 From: Ren Silva Date: Thu, 27 Nov 2025 09:57:37 +1100 Subject: [PATCH 2/3] Update .devcontainer/post-create.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .devcontainer/post-create.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index a49bfc740990..40995a8fcfa9 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -11,4 +11,10 @@ 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" \ No newline at end of file +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" + +echo "๐Ÿ”“ Setting PowerShell execution policy to Unrestricted..." +pwsh -c "Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser" \ No newline at end of file From bc262d1e15e1552b7f5d799ed73483a92eb8baf3 Mon Sep 17 00:00:00 2001 From: Ren Silva Date: Thu, 27 Nov 2025 10:32:48 +1100 Subject: [PATCH 3/3] removed execution policy from devcontainers - not needed and crashes --- .devcontainer/post-create.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 40995a8fcfa9..24092f22a30d 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -16,5 +16,3 @@ 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" -echo "๐Ÿ”“ Setting PowerShell execution policy to Unrestricted..." -pwsh -c "Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser" \ No newline at end of file