Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch Archive module #551

Merged
merged 21 commits into from
May 23, 2024
19 changes: 19 additions & 0 deletions NEWGENERIC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Monthly generic update workflow

## Check latest updates of packages

Update DOCKERFILE AND DOCKERFILE-filesonly

SQL Server
https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/build-versions

dotnet 8
https://dotnet.microsoft.com/en-us/download/dotnet/8.0 - grab the direct link behind ASP.NET Core Runtime Windows -> Hosting Bundle

dotnet 6
https://dotnet.microsoft.com/en-us/download/dotnet/6.0 - grab the direct link behind ASP.NET Core Runtime Windows -> Hosting Bundle

PowerShell 7
https://github.com/PowerShell/PowerShell/releases - grab the latest PowerShell-7.4.x-win-x64.msi link

Remember filesonly="yes" at the end of DOCKERFILE-filesonly
120 changes: 2 additions & 118 deletions generic/DOCKERFILE
Original file line number Diff line number Diff line change
Expand Up @@ -15,125 +15,9 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref

COPY Run /Run/

RUN Write-Host ('FilesOnly='+$env:filesOnly); \
Write-Host ('only24='+$env:only24); \
$filesonly = $env:filesonly -eq 'true'; \
$only24 = $env:only24 -eq 'true'; \
if ($only24) { Remove-Item -Recurse -Force Run/70,Run/71,Run/80,Run/90,Run/100,Run/110,Run/130,Run/150,Run/150-new,Run/210,Run/210-new }; \
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; \
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.Filesystem') | Out-Null ; \
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord; \
Set-ItemProperty -Path 'HKLM:\system\CurrentControlSet\control' -name ServicesPipeTimeout -Value 300000 -Type DWORD -Force; \
New-Item 'temp' -ItemType Directory | Out-Null; \
if (-not $filesonly) { \
if ($only24) { \
Write-Host 'Adding Windows Features for BC 24+'; \
Add-WindowsFeature Web-Server,web-AppInit,web-Windows-Auth,web-Dyn-Compression,web-WebSockets; \
Stop-Service 'W3SVC' ; \
Set-Service 'W3SVC' -startuptype manual ; \
} \
else { \
Write-Host 'Adding Windows Features for BC'; \
Add-WindowsFeature Web-Server,web-AppInit,web-Asp-Net45,web-Windows-Auth,web-Dyn-Compression,web-WebSockets; \
Stop-Service 'W3SVC' ; \
Set-Service 'W3SVC' -startuptype manual ; \
} \
Write-Host 'Downloading SQL Server 2019 Express'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://go.microsoft.com/fwlink/p/?linkid=866658' -OutFile 'temp\SQL2019-SSEI-Expr.exe'; \
$configFileLocation = 'c:\run\SQLConf.ini'; \
Write-Host 'Installing SQL Server 2019 Express'; \
$process = Start-Process -FilePath 'temp\SQL2019-SSEI-Expr.exe' -ArgumentList /Action=Install, /ConfigurationFile=$configFileLocation, /IAcceptSQLServerLicenseTerms, /Quiet -NoNewWindow -Wait -PassThru; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading SQL Server 2019 Cumulative Update'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://download.microsoft.com/download/6/e/7/6e72dddf-dfa4-4889-bc3d-e5d3a0fd11ce/SQLServer2019-KB5035123-x64.exe' -OutFile 'temp\SQL2019CU.exe'; \
Write-Host 'Installing SQL Server 2019 Cumulative Update'; \
$process = Start-Process -FilePath 'temp\SQL2019CU.exe' -ArgumentList /Action=Patch, /Quiet, /IAcceptSQLServerLicenseTerms, /AllInstances, /SuppressPrivacyStatementNotice -NoNewWindow -Wait -PassThru; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Configuring SQL Server 2019 Express'; \
Set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql15.SQLEXPRESS\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpdynamicports -value '' ; \
Set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql15.SQLEXPRESS\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpport -value 1433 ; \
Set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql15.SQLEXPRESS\mssqlserver\' -name LoginMode -value 2 ; \
Set-Service 'MSSQL$SQLEXPRESS' -startuptype manual ; \
Set-Service 'SQLTELEMETRY$SQLEXPRESS' -startuptype manual ; \
Set-Service 'SQLWriter' -startuptype manual ; \
Set-Service 'SQLBrowser' -startuptype manual ; \
Write-Host 'Removing SQL Server 2019 Express Install Files'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'SQL2019'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'C:\Program Files\Microsoft SQL Server\150\Setup Bootstrap'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'C:\Program Files\Microsoft SQL Server\150\SSEI'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Template Data'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Log\*'; \
} \
Write-Host 'Downloading NAV/BC Docker Install Files'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://bcdocker.blob.core.windows.net/public/nav-docker-install.zip' -OutFile 'temp\nav-docker-install.zip' ; \
Write-Host 'Extracting NAV/BC Docker Install Files'; \
[System.IO.Compression.ZipFile]::ExtractToDirectory('temp\nav-docker-install.zip', 'c:\run') ; \
Write-Host 'Updating PowerShell Execution Policy to Unrestricted'; \
. C:\Run\UpdatePowerShellExeConfig.ps1 ; \
. C:\Run\helperfunctions.ps1 ; \
if (-not $filesonly) { \
Write-Host 'Starting SQL Server Services'; \
Start-Service -Name $SqlBrowserServiceName -ErrorAction Ignore -WarningAction Ignore ; \
Start-Service -Name $SqlWriterServiceName -ErrorAction Ignore -WarningAction Ignore ; \
Start-Service -Name $SqlServiceName -ErrorAction Ignore -WarningAction Ignore ; \
Write-Host 'Downloading rewrite_amd64'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi' -OutFile 'temp\rewrite_amd64.msi' ; \
Write-Host 'Installing rewrite_amd64'; \
$process = start-process -Wait -FilePath 'temp\rewrite_amd64.msi' -ArgumentList /quiet, /qn, /passive ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading SQL Server Native Client'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://download.microsoft.com/download/B/E/D/BED73AAC-3C8A-43F5-AF4F-EB4FEA6C8F3A/ENU/x64/sqlncli.msi' -OutFile 'temp\sqlncli.msi' ; \
Write-Host 'Installing SQL Server Native Client'; \
$process = start-process -Wait -FilePath 'temp\sqlncli.msi' -ArgumentList /quiet, /qn, /passive ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
} \
Write-Host 'Downloading OpenXMLSDKV25'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://bcartifacts.blob.core.windows.net/prerequisites/OpenXMLSDKv25.msi' -OutFile 'temp\OpenXMLSDKV25.msi' ; \
Write-Host 'Installing OpenXMLSDKV25'; \
$process = start-process -Wait -FilePath 'temp\OpenXMLSDKV25.msi' -ArgumentList /quiet, /qn, /passive ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading dotnet 6'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://download.visualstudio.microsoft.com/download/pr/b54e1bdd-2525-4414-a93a-27c62b329e47/c34cf7303786e74a20f7125475ffa511/dotnet-hosting-6.0.29-win.exe' -OutFile 'temp\DotNet6-Win.exe' ; \
Write-Host 'Installing dotnet 6'; \
$process = start-process -Wait -FilePath 'temp\DotNet6-Win.exe' -ArgumentList /quiet ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading dotnet 8'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://download.visualstudio.microsoft.com/download/pr/00397fee-1bd9-44ef-899b-4504b26e6e96/ab9c73409659f3238d33faee304a8b7c/dotnet-hosting-8.0.4-win.exe' -OutFile 'temp\DotNet8-Win.exe' ; \
Write-Host 'Installing dotnet 8'; \
$process = start-process -Wait -FilePath 'temp\DotNet8-Win.exe' -ArgumentList /quiet ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading PowerShell 7.4.1'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/PowerShell-7.4.1-win-x64.msi' -OutFile 'temp\powershell-7.4.1-win-x64.msi' ; \
Write-Host 'Installing PowerShell 7.4.1'; \
$process = start-process -Wait -FilePath 'temp\powershell-7.4.1-win-x64.msi' -ArgumentList /quiet ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
if (-not $only24) { \
Write-Host 'Downloading vcredist_x86'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://aka.ms/highdpimfc2013x86enu' -OutFile 'temp\vcredist_x86.exe' ; \
Write-Host 'Installing vcredist_x86'; \
$process = start-process -Wait -FilePath 'temp\vcredist_x86.exe' -ArgumentList /q, /norestart ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Downloading vcredist_x64'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://aka.ms/highdpimfc2013x64enu' -OutFile 'temp\vcredist_x64.exe' ; \
Write-Host 'Installing vcredist_x64'; \
$process = start-process -Wait -FilePath 'temp\vcredist_x64.exe' -ArgumentList /q, /norestart ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
} \
Write-Host 'Downloading vcredist_x64_140'; \
Invoke-RestMethod -Method Get -UseBasicParsing -Uri 'https://aka.ms/vs/17/release/vc_redist.x64.exe' -OutFile 'temp\vcredist_x64_140.exe' ; \
Write-Host 'Installing vcredist_x64_140'; \
$process = start-process -Wait -FilePath 'temp\vcredist_x64_140.exe' -ArgumentList /q, /norestart ; \
if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' }; \
Write-Host 'Removing temp folder'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'temp'; \
Write-Host 'Cleanup temporary files'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $env:TEMP\*; \
Write-Host 'Remove x86 dotnet files'; \
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'C:\Program Files (x86)\dotnet'
RUN . .\Run\SetupGeneric1.ps1

RUN Write-Host 'Installing SqlServer Module in PowerShell 7'; \
pwsh -Command 'Install-Module -Name SqlServer -RequiredVersion 22.2.0 -Scope AllUsers -Force'; \
Write-Host 'Done'
RUN . .\Run\SetupGeneric2.ps1

HEALTHCHECK --interval=30s --timeout=10s CMD [ "powershell", ".\\Run\\HealthCheck.ps1" ]

Expand Down