Windows docker images for Agent and Agent2 components

This commit is contained in:
dotneft 2021-09-04 05:05:08 +03:00
parent f6af8350ae
commit 8f1283523e
2 changed files with 116 additions and 75 deletions

View File

@ -26,36 +26,47 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
RUN Set-Location -Path "$env:SystemDrive"; `
Write-Verbose -Message 'Visual Studio components installing...'; `
Invoke-WebRequest -OutFile "$env:SystemDrive\git-installer.exe" $env:GIT_URL; `
$sha256 = 'a5704733c219e9a0c96bfeb0febef62bc2518bdd4e358bc9519dbc5e63a3b5fe'; `
if ((Get-FileHash "$env:SystemDrive\git-installer.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum GIT for Windows failed!"; `
exit 1; `
}; `
Start-Process -FilePath "$env:SystemDrive\git-installer.exe" -argumentlist '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc_sh,ext,ext\shellhere,gitlfs' -wait; `
Remove-Item -Force -Path "$env:SystemDrive\git-installer.exe"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\nasm-installer.exe" $env:NASM_URL; `
$sha256 = 'a02325b9fe54f917f5d6a3036637b38dbb6addf6f7ba9d344d9b943a143fe7d0'; `
if ((Get-FileHash "$env:SystemDrive\nasm-installer.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum NASM failed!"; `
exit 1; `
}; `
Start-Process -FilePath "$env:SystemDrive\nasm-installer.exe" -argumentlist '/S'; `
Invoke-WebRequest -OutFile "$env:SystemDrive\perl-installer.msi" $env:PERL_URL; `
$sha256 = '241a881670164feb0b91bb69d39fbbf84c981bec0d9f8c19959f8f48fd177768'; `
if ((Get-FileHash "$env:SystemDrive\perl-installer.msi" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum Strawberry Perl failed!"; `
exit 1; `
}; `
Start-Process -FilePath "msiexec.exe" -argumentlist """/i C:\perl-installer.msi /qn /norestart INSTALLDIR=$env:SystemDrive\Strawberry""" -wait; `
$env:PATH+=""";$env:SystemDrive\Strawberry\perl\bin"""; `
cpan Text::Template; `
Remove-Item -Force -Path "$env:SystemDrive\nasm-installer.exe"; `
Remove-Item -Force -Path "$env:SystemDrive\perl-installer.msi"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\vs_buildtools.exe" $env:VS_BUILDTOOLS_URL; `
$sha256 = 'f3a7e2868c203490a4095231e20e628bf661b7469f2d53626f3fbbdfc161d471'; `
if ((Get-FileHash "$env:SystemDrive\vs_buildtools.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum Visual Studio Build tools failed!"; `
exit 1; `
}; `
Write-Host "Visual Studio components installing..."; `
cmd /C start /w "$env:SystemDrive\vs_buildtools.exe" --quiet --wait --norestart --nocache modify `
--installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" `
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Workload.MSBuildTools `
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools `
--add Microsoft.Net.Component.4.8.SDK `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
--remove Microsoft.VisualStudio.Component.Windows81SDK `
--remove Microsoft.VisualStudio.Component.WebDeploy `
--remove Microsoft.Component.ClickOnce.MSBuild; `
--add Microsoft.VisualStudio.Component.VC.CMake.Project; `
if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { `
throw $err; `
}; `
Wait-Process -name msiexec; `
Write-Host "Visual Studio components installed"; `
Remove-Item -Force -Path "$env:SystemDrive\vs_buildtools.exe"; `
Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force Recurse; `
@ -65,6 +76,11 @@ RUN Set-Location -Path "$env:SystemDrive"; `
Import-Module """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; `
Enter-VsDevShell -VsInstallPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
Invoke-WebRequest -OutFile "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" https://ftp.pcre.org/pub/pcre/pcre-$env:PCRE_VERSION.zip; `
$sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; `
if ((Get-FileHash "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum PCRE library failed!"; `
exit 1; `
}; `
Expand-Archive -Path "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" -DestinationPath $env:SystemDrive ; `
Rename-Item -Path "$env:SystemDrive\pcre-$env:PCRE_VERSION" -NewName "$env:SystemDrive\pcre_build"; `
New-Item -ItemType directory -Path "$env:SystemDrive\pcre_build\build" | Out-Null; `
@ -82,6 +98,11 @@ RUN Set-Location -Path "$env:SystemDrive"; `
Import-Module """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; `
Enter-VsDevShell -VsInstallPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
Invoke-WebRequest -OutFile "$env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz" https://www.openssl.org/source/openssl-$env:OPENSSL_VERSION.tar.gz; `
$sha256 = '0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1'; `
if ((Get-FileHash "$env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum OpenSSL library failed!"; `
exit 1; `
}; `
tar -zxf $env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz; `
Rename-Item -Path "$env:SystemDrive\openssl-$env:OPENSSL_VERSION" -NewName "$env:SystemDrive\openssl_build"; `
Set-Location -Path "$env:SystemDrive\openssl_build"; `
@ -93,7 +114,7 @@ RUN Set-Location -Path "$env:SystemDrive"; `
# enable-capieng `
no-capieng `
--api=1.1.0 `
--prefix="$env:SystemDrive\openssl_output_$env:BUILD_ARCH `
--prefix="$env:SystemDrive\openssl_output_$env:BUILD_ARCH" `
--openssldir="$env:SystemDrive\openssl_output_ssl"; `
set CL=/MP; `
nmake; `
@ -122,7 +143,7 @@ FROM builder_base as builder_zabbix
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG MAJOR_VERSION=6,0
ARG MAJOR_VERSION=6.0
ARG ZBX_VERSION=${MAJOR_VERSION}.0
ARG ZABBIX_VERSION_RC_NUM=2400
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git

View File

@ -29,7 +29,7 @@ RUN Set-Location -Path "$env:SystemDrive"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\git-installer.exe" $env:GIT_URL; `
$sha256 = 'a5704733c219e9a0c96bfeb0febef62bc2518bdd4e358bc9519dbc5e63a3b5fe'; `
if ((Get-FileHash "$env:SystemDrive\git-installer.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum failed!"; `
Write-Host "Checksum GIT for Windows failed!"; `
exit 1; `
}; `
Start-Process -FilePath "$env:SystemDrive\git-installer.exe" -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc_sh,ext,ext\shellhere,gitlfs' -wait; `
@ -37,37 +37,43 @@ RUN Set-Location -Path "$env:SystemDrive"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\go$env:GOLANG_VERSION.windows-amd64.msi" https://golang.org/dl/go$env:GOLANG_VERSION.windows-amd64.msi; `
$sha256 = '705254e0a459edae2c6bf4c88be0b4a14ac1cbbf9607a379112235f0271e6c4b'; `
if ((Get-FileHash "$env:SystemDrive\go$env:GOLANG_VERSION.windows-amd64.msi" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum failed!"; `
Write-Host "Checksum Go Lang failed!"; `
exit 1; `
}; `
Start-Process -FilePath "$env:SystemDrive\go$env:GOLANG_VERSION.windows-amd64.msi" -Wait -ArgumentList '/qn /norestart'; `
Remove-Item -Force -Path "$env:SystemDrive\go$env:GOLANG_VERSION.windows-amd64.msi"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\7z$env:SEVEN_ZIP_VERSION-$env:BUILD_ARCH.msi" https://www.7-zip.org/a/7z$env:SEVEN_ZIP_VERSION-$env:BUILD_ARCH.msi; `
$sha256 = 'a7803233eedb6a4b59b3024ccf9292a6fffb94507dc998aa67c5b745d197a5dc'; `
if ((Get-FileHash "$env:SystemDrive\7z$env:SEVEN_ZIP_VERSION-$env:BUILD_ARCH.msi" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum 7-zip failed!"; `
exit 1; `
}; `
Start-Process -FilePath "$env:SystemDrive\7z$env:SEVEN_ZIP_VERSION-$env:BUILD_ARCH.msi" -Wait -ArgumentList '/qn /norestart'; `
Remove-Item -Force -Path "$env:SystemDrive\7z$env:SEVEN_ZIP_VERSION-$env:BUILD_ARCH.msi"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\mingw.7z" $env:MINGW_URL; `
$sha256 = 'e8c65ddc655534b0330f66f7b480565621e8617cda9937d76ba141a22bf3b2fa'; `
if ((Get-FileHash "$env:SystemDrive\mingw.7z" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum Mingw-w64 failed!"; `
exit 1; `
}; `
Start-Process -FilePath "${env:ProgramFiles}\7-Zip\7z.exe" -Wait -ArgumentList """x $env:SystemDrive\mingw.7z"""; `
Remove-Item -Force -Path "$env:SystemDrive\mingw.7z"; `
Invoke-WebRequest -OutFile "$env:SystemDrive\vs_buildtools.exe" $env:VS_BUILDTOOLS_URL; `
$sha256 = 'f3a7e2868c203490a4095231e20e628bf661b7469f2d53626f3fbbdfc161d471'; `
if ((Get-FileHash "$env:SystemDrive\vs_buildtools.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum Visual Studio Build tools failed!"; `
exit 1; `
}; `
Write-Host "Visual Studio components installing..."; `
cmd /C start /w "$env:SystemDrive\vs_buildtools.exe" --quiet --wait --norestart --nocache modify `
--installPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" `
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Workload.MSBuildTools `
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools `
--add Microsoft.Net.Component.4.8.SDK `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
--remove Microsoft.VisualStudio.Component.Windows81SDK `
--remove Microsoft.VisualStudio.Component.WebDeploy `
--remove Microsoft.Component.ClickOnce.MSBuild; `
--add Microsoft.VisualStudio.Component.VC.CMake.Project; `
if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { `
throw $err; `
}; `
Wait-Process -name msiexec; `
Write-Host "Visual Studio components installed"; `
Remove-Item -Force -Path "$env:SystemDrive\vs_buildtools.exe"; `
Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force Recurse; `
@ -78,6 +84,11 @@ RUN Set-Location -Path "$env:SystemDrive"; `
Enter-VsDevShell -VsInstallPath """${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools""" -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
$env:PATH+=""";$env:SystemDrive\mingw64\bin"""; `
Invoke-WebRequest -OutFile "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" https://ftp.pcre.org/pub/pcre/pcre-$env:PCRE_VERSION.zip; `
$sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; `
if ((Get-FileHash "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum PCRE library failed!"; `
exit 1; `
}; `
Expand-Archive -Path "$env:SystemDrive\pcre-$env:PCRE_VERSION.zip" -DestinationPath $env:SystemDrive; `
Rename-Item -Path "$env:SystemDrive\pcre-$env:PCRE_VERSION" -NewName "$env:SystemDrive\pcre_build_mingw"; `
Set-Location -Path "$env:SystemDrive\pcre_build_mingw"; `
@ -94,12 +105,22 @@ RUN Set-Location -Path "$env:SystemDrive"; `
RUN Set-Location -Path "$env:SystemDrive"; `
(New-Object Net.WebClient).DownloadFile("""$env:CYGWIN_URL""", """$env:SystemDrive\setup-x86_64.exe"""); `
Start-Process "$env:SystemDrive\setup-x86_64.exe" -ArgumentList """-qnNdO -R $env:SystemDrive\Cygwin64 --site http://cygwin.mirror.constant.com -l $env:SystemDrive\cygwin64\var\cache\setup --packages perl""" -Wait -NoNewWindow; `
$sha256 = 'b9219acd1241ffa4d38e19587f1ccc2854f951e451f3858efc9d2e1fe19d375c'; `
if ((Get-FileHash "$env:SystemDrive\setup-x86_64.exe" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum Cygwin failed!"; `
exit 1; `
}; `
Start-Process "$env:SystemDrive\setup-x86_64.exe" -ArgumentList """-qnNdO -a x86_64 -R $env:SystemDrive\cygwin --site http://cygwin.mirror.constant.com -l $env:SystemDrive\cygwin\var\cache\setup --packages perl""" -Wait -NoNewWindow; `
Invoke-WebRequest -OutFile "$env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz" https://www.openssl.org/source/openssl-$env:OPENSSL_VERSION.tar.gz; `
$sha256 = '0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1'; `
if ((Get-FileHash "$env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz" -Algorithm sha256).Hash -ne $sha256) { `
Write-Host "Checksum OpenSSL library failed!"; `
exit 1; `
}; `
tar -zxf $env:SystemDrive\openssl-$env:OPENSSL_VERSION.tar.gz; `
Rename-Item -Path "$env:SystemDrive\openssl-$env:OPENSSL_VERSION" -NewName "$env:SystemDrive\openssl_build_mingw"; `
Set-Location -Path "$env:SystemDrive\openssl_build_mingw"; `
$env:PATH+=""";$env:SystemDrive\mingw64\bin;$env:SystemDrive\Cygwin64\bin"""; `
$env:PATH+=""";$env:SystemDrive\mingw64\bin;$env:SystemDrive\cygwin\bin"""; `
perl Configure `
mingw64 `
no-shared `
@ -108,11 +129,11 @@ RUN Set-Location -Path "$env:SystemDrive"; `
# enable-capieng `
no-capieng `
--api=1.1.0 `
--prefix="$env:SystemDrive\openssl_output_mingw" `
--openssldir="$env:SystemDrive\openssl_output_ssl_mingw"; `
--prefix="$env:SystemDrive\openssl_output" `
--openssldir="$env:SystemDrive\openssl_output_ssl"; `
mingw32-make -j"""$env:NUMBER_OF_PROCESSORS"""; `
mingw32-make -j"""$env:NUMBER_OF_PROCESSORS""" install_sw; `
Remove-Item -Recurse -Force -Path "$env:SystemDrive\Cygwin64"; `
Remove-Item -Recurse -Force -Path "$env:SystemDrive\cygwin"; `
Remove-Item -Force -Path "$env:SystemDrive\setup-x86_64.exe"
FROM builder_base as builder_zabbix
@ -137,11 +158,10 @@ RUN Set-Location -Path "$env:SystemDrive"; `
$env:PATH+=""";$env:SystemDrive\mingw64\bin"""; `
Set-Location -Path "$env:SystemDrive\zabbix-$env:ZBX_VERSION\build\mingw"; `
mingw32-make -j"""$env:NUMBER_OF_PROCESSORS""" `
# CGO_LDFLAGS="""-lssl -lcrypto -lcrypt32 -L$env:SystemDrive\openssl_output\lib -L$env:SystemDrive\pcre_output\lib""" `
PCRE="$env:SystemDrive\pcre_output_mingw" `
OPENSSL="$env:SystemDrive\openssl_output_mingw" `
RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM""" `
# CGO_LDFLAGS="""-lssl -lcrypto -lcrypt32 -L$env:SystemDrive\openssl_output_mingw\lib -L$env:SystemDrive\pcre_output_mingw\lib""" `
OPENSSL="$env:SystemDrive\openssl_output_mingw"; `
OPENSSL="$env:SystemDrive\openssl_output" `
RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM"""; `
New-Item -ItemType directory -Path "$env:SystemDrive\zabbix2" | Out-Null; `
New-Item -ItemType directory -Path "$env:SystemDrive\zabbix2\sbin" | Out-Null; `
New-Item -ItemType directory -Path "$env:SystemDrive\zabbix2\conf" | Out-Null; `