Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created October 22, 2019 16:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamdriscoll/7219d03837e22a43cd736d23dac06b6a to your computer and use it in GitHub Desktop.
Save adamdriscoll/7219d03837e22a43cd736d23dac06b6a to your computer and use it in GitHub Desktop.
Create a docker container image with Universal Dashboard.
Import-Module "$PSScriptRoot/UniversalDashboard.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.CodeEditor/1.0.1/UniversalDashboard.CodeEditor.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.Helmet/1.0.1/UniversalDashboard.Helmet.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.Style/1.0.0/UniversalDashboard.Style.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.Diagrams/1.0.1/UniversalDashboard.Diagrams.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.SyntaxHighlighter/1.0.0/UniversalDashboard.SyntaxHighlighter.psd1"
Import-Module "$PSScriptRoot/UniversalDashboard.ObjectTree/1.0.1/UniversalDashboard.ObjectTree.psd1"
# Provides the New-CustomDashboard cmdlet.
Import-Module "$PSScriptRoot/Dashboard/Dashboard.psd1"
$Dashboard = New-CustomDashboard
Start-UDDashboard -Dashboard $Dashboard -Port 8080 -Wait
Set-Location $PSScriptRoot
$Staging = "$PSScriptRoot/stage"
Remove-Item $Staging -Force -Recurse -ErrorAction SilentlyContinue
New-Item $Staging -Force -ItemType Dir | Out-null
# This is where I have my dashboard.ps1 scripts and stuff. It's actually a module that contains cmdlets to create a dashboard.
Copy-Item -Path "$PSScriptRoot/../output-dashboard/" -Destination "$Staging/Dashboard" -Recurse
Save-Module -Name UniversalDashboard -Path $Staging -AcceptLicense -RequiredVersion 2.6.2
Copy-Item -Path "$Staging/UniversalDashboard/2.6.2/*" -Destination $Staging -Container -Recurse
Remove-Item -Path "$Staging/UniversalDashboard/2.6.2" -Force -Recurse
Save-Module -Name UniversalDashboard.CodeEditor -Path $Staging -RequiredVersion 1.0.1
Save-Module -Name UniversalDashboard.Helmet -Path $Staging -RequiredVersion 1.0.1
Save-Module -Name UniversalDashboard.Style -Path $Staging -RequiredVersion 1.0
Save-Module -Name UniversalDashboard.Diagrams -Path $Staging -RequiredVersion 1.0.1
Save-Module -Name UniversalDashboard.SyntaxHighlighter -Path $Staging -RequiredVersion 1.0.0
Save-Module -Name UniversalDashboard.ObjectTree -Path $Staging -RequiredVersion 1.0.1
docker build . --tag=universaldashboardocker
FROM mcr.microsoft.com/powershell:latest
LABEL description="Universal Dashboard Docker"
EXPOSE 8080
COPY [ "./stage", "/home/" ]
COPY [ "./bootstrap.ps1", "/home/bootstrap.ps1" ]
ENTRYPOINT ["pwsh", "/home/bootstrap.ps1"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment