Skip to content

Commit 8909612

Browse files
authored
Update dev container (#50)
1 parent f6503b3 commit 8909612

9 files changed

Lines changed: 69 additions & 39 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

.devcontainer/container-build.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
# Note:
55
# This is run during container creation.
66

7+
sudo apt-get update -y
8+
sudo apt-get upgrade -y
9+
710
# Install PowerShell dependencies
811
$ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue;
912
if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
1013
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
1114
}
12-
if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.5 -ErrorAction Ignore)) {
13-
Install-Module -Name PowerShellGet -MinimumVersion 2.2.5 -Scope CurrentUser -Force -AllowClobber;
15+
if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -ErrorAction Ignore)) {
16+
Install-Module PowerShellGet -MinimumVersion 2.2.1 -Scope CurrentUser -Force -AllowClobber;
1417
}
15-
if ($Null -eq (Get-InstalledModule -Name PSRule.Rules.Azure -MinimumVersion 1.19.2 -ErrorAction Ignore)) {
16-
Install-Module -Name PSRule.Rules.Azure -MinimumVersion 1.19.2 -Scope CurrentUser -Force;
18+
if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) {
19+
Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force;
1720
}

.devcontainer/container-start.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
Update-Module PSRule.Rules.Azure -Scope CurrentUser -Force;
99

1010
# Fetch the latest Bicep CLI binary
11-
curl -Lo bicep-cli https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
11+
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
1212
# Mark it as executable
13-
chmod +x ./bicep-cli
13+
chmod +x ./bicep
1414
# Add bicep to your PATH (requires admin)
15-
sudo mv ./bicep-cli /usr/local/bin/bicep --force
15+
sudo mv ./bicep /usr/local/bin/bicep
16+
# Verify you can now access the 'bicep' command
17+
bicep --version
18+
# Done!

.devcontainer/devcontainer.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
13
{
2-
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
34
"name": "PSRule for Azure QuickStart",
5+
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-noble",
46
"customizations": {
57
"vscode": {
68
"settings": {
79
"terminal.integrated.defaultProfile.linux": "pwsh",
810
"terminal.integrated.profiles.linux": {
911
"pwsh": {
10-
"path": "/opt/microsoft/powershell/7/pwsh"
12+
"path": "/usr/bin/pwsh"
1113
}
1214
}
1315
},
1416
"extensions": [
15-
"ms-dotnettools.csharp",
17+
"ms-dotnettools.csdevkit",
1618
"ms-vscode.powershell",
19+
"ms-azuretools.vscode-bicep",
20+
"GitHub.vscode-pull-request-github",
21+
"github.vscode-github-actions",
1722
"bewhite.psrule-vscode",
1823
"msazurermtools.azurerm-vscode-tools",
19-
"ms-azuretools.vscode-bicep",
24+
"davidanson.vscode-markdownlint",
25+
"streetsidesoftware.code-spell-checker",
26+
"eamodio.gitlens",
27+
"ms-sarifvscode.sarif-viewer",
28+
"github.vscode-github-actions",
2029
"ms-azure-devops.azure-pipelines"
2130
]
2231
}
2332
},
2433
"features": {
25-
"ghcr.io/devcontainers/features/github-cli": {
34+
"ghcr.io/devcontainers/features/github-cli:1": {
2635
"version": "latest"
2736
},
28-
"ghcr.io/devcontainers/features/azure-cli": {
29-
"installBicep": false,
37+
"ghcr.io/devcontainers/features/azure-cli:1": {
3038
"version": "latest"
31-
},
32-
"ghcr.io/devcontainers/features/powershell": {
33-
"version": "latest",
34-
"modules": "PSRule.Rules.Azure"
3539
}
3640
},
37-
"onCreateCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1",
38-
"postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1",
39-
"build": {
40-
"dockerfile": "Dockerfile"
41-
},
42-
"remoteUser": "vscode"
41+
"onCreateCommand": "dotnet tool install --global PowerShell --version 7.4.7 && sudo chown -R vscode:vscode /usr/bin/pwsh && sudo apt-get update -y && sudo apt-get upgrade -y && dotnet restore && ln /usr/bin/pwsh /home/vscode/.dotnet/tools/pwsh --force",
42+
"updateContentCommand": "/usr/bin/pwsh -f .devcontainer/container-build.ps1",
43+
"postStartCommand": "/usr/bin/pwsh -f .devcontainer/container-start.ps1"
4344
}

.devcontainer/first-run-notice.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,27 @@ updates:
1212
directory: '/'
1313
schedule:
1414
interval: 'daily'
15+
labels:
16+
- dependencies
17+
reviewers:
18+
- azure/psrule-rules-azure
19+
20+
# Maintain dependencies for GitHub Actions
21+
- package-ecosystem: github-actions
22+
directory: '/'
23+
schedule:
24+
interval: daily
25+
labels:
26+
- dependencies
27+
reviewers:
28+
- azure/psrule-rules-azure
29+
30+
# Maintain dependencies for Dev Containers
31+
- package-ecosystem: devcontainers
32+
directory: '/'
33+
schedule:
34+
interval: daily
35+
labels:
36+
- dependencies
37+
reviewers:
38+
- azure/psrule-rules-azure

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ on:
1919
pull_request:
2020
branches:
2121
- main
22+
schedule:
23+
- cron: '54 20 * * 0' # At 08:54 PM, on Sunday each week
2224
workflow_dispatch:
2325

2426
permissions: {}

bicepconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"experimentalFeaturesEnabled": {
3+
"optionalModuleNames": true
4+
}
5+
}

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"allowPrerelease": false,
4+
"version": "8.0.400",
5+
"rollForward": "latestPatch"
6+
}
7+
}

0 commit comments

Comments
 (0)