Last active
September 11, 2023 14:34
-
-
Save JustinGrote/f7da8d3eb0dd431718dedc3b9f356ef8 to your computer and use it in GitHub Desktop.
Powershell Universal VSCode devcontainer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | |
| // https://github.com/microsoft/vscode-dev-containers/tree/v0.169.0/containers/powershell | |
| { | |
| "name": "PowerShell", | |
| "dockerFile": "Dockerfile", | |
| // Set *default* container specific settings.json values on container create. | |
| "settings": { | |
| "terminal.integrated.shell.linux": "/usr/bin/pwsh", | |
| "powerShellUniversal.serverPath": "/home/Universal", | |
| // Additional ports unnecessarily forwarded | |
| "remote.autoForwardPorts": false | |
| }, | |
| "containerEnv": { | |
| "Data__RepositoryPath": "${containerWorkspaceFolder}" | |
| }, | |
| // Add the IDs of extensions you want installed when the container is created. | |
| "extensions": [ | |
| "ms-vscode.powershell-preview", | |
| "ironmansoftware.powershell-universal", | |
| "tylerleonhardt.vscode-pester-test-adapter", | |
| "tylerleonhardt.vscode-inline-values-powershell", | |
| "ironmansoftware.powershellprotools" | |
| ], | |
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | |
| "forwardPorts": [ | |
| 5000 | |
| ], | |
| "portsAttributes": { | |
| "5000": { | |
| "label": "PowershellUniversal" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Typical values: lts, preview, 7.1.3, 7.2.0-preview.5 | |
| #See: https://hub.docker.com/_/microsoft-powershell | |
| ARG PWSHVERSION=lts | |
| FROM mcr.microsoft.com/powershell:${PWSHVERSION}-ubuntu-18.04 | |
| LABEL description="Powershell Universal" | |
| SHELL ["pwsh", "-noninteractive", "-command"] | |
| #Path to Powershell Universal | |
| ARG PSUPATH=/home/Universal | |
| ARG PSUDATAPATH=/data | |
| #Specify latest to get the latest version or a specific version (e.g. 1.5.16) if otherwise | |
| ARG PSUVERSION=latest | |
| ARG PSUMODULEVERSION=$PSUVERSION | |
| RUN apt update && apt install -y git && apt clean; | |
| RUN $ErrorActionPreference='Stop'; $ProgressPreference = 'silentlyContinue';\ | |
| [hashtable]$imParams = if ($env:PSUMODULEVERSION -and $env:PSUMODULEVERSION -ne 'latest') { @{RequiredVersion = $env:PSUMODULEVERSION} } else {@{}}; \ | |
| "Installing Universal Module " + $env:PSUMODULEVERSION; \ | |
| Install-Module @imParams -Name Universal -Force; \ | |
| [hashtable]$psuParams = if ($env:PSUVERSION -and $env:PSUVERSION -ne 'latest') { @{Version = $env:PSUVERSION}} else {@{}}; \ | |
| "Installing Powershell Universal " + $env:PSUMODULEVERSION; \ | |
| Install-PSUServer @psuParams -Path $env:PSUPATH; \ | |
| chmod +x $env:PSUPATH/Universal.Server; \ | |
| New-Item -ItemType Directory $env:PSUDATAPATH; \ | |
| usermod --shell /usr/bin/pwsh root; | |
| ENV Data__RepositoryPath=$PSUDATAPATH/Repository | |
| ENV Data__ConnectionString=$PSUDATAPATH/database.db | |
| ENV UniversalDashboard__AssetsFolder=$PSUDATAPATH/UniversalDashboard | |
| ENV Logging__Path=$PSUDATAPATH/logs/log.txt | |
| #Default entry point: Start Server | |
| ENTRYPOINT ["/home/Universal/Universal.Server"] | |
| EXPOSE 5000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment