mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-09 00:24:58 +02:00
Prepared build base images for Zabbix agents on Windows
This commit is contained in:
67
Dockerfiles/build-mysql/windows/Dockerfile.agent
Normal file
67
Dockerfiles/build-mysql/windows/Dockerfile.agent
Normal file
@ -0,0 +1,67 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# escape=`
|
||||
ARG MAJOR_VERSION=6.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||
ARG BUILD_BASE_IMAGE=zabbix-build-base:ltsc2022-agent-${ZBX_VERSION}
|
||||
|
||||
FROM ${BUILD_BASE_IMAGE} as builder
|
||||
|
||||
ARG MAJOR_VERSION
|
||||
ARG ZBX_VERSION
|
||||
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
||||
ARG ZABBIX_VERSION_RC_NUM=2400
|
||||
ARG ZBX_COMPONENT=all
|
||||
ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION ZABBIX_VERSION_RC_NUM=$ZABBIX_VERSION_RC_NUM
|
||||
|
||||
LABEL org.opencontainers.image.title="Zabbix agent build (Windows)" \
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
org.opencontainers.image.vendor="Zabbix LLC" \
|
||||
org.opencontainers.image.url="https://zabbix.com/" \
|
||||
org.opencontainers.image.description="Zabbix build for agent images based on Windows" \
|
||||
org.opencontainers.image.licenses="GPL v2.0" \
|
||||
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="${ZBX_SOURCES}"
|
||||
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
`
|
||||
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
||||
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Write-Host ('Checkout GIT {0} (master) repository ...' -f $env:ZBX_SOURCES); `
|
||||
git -c advice.detachedHead=false clone $env:ZBX_SOURCES --branch master --depth 1 --single-branch $env:SystemDrive\zabbix-$env:ZBX_VERSION; `
|
||||
`
|
||||
Write-Host ('Building Zabbix {0} version ...' -f $env:ZBX_VERSION); `
|
||||
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION; `
|
||||
$ZbxRevision=(git rev-parse --short HEAD); `
|
||||
(Get-Content include/version.h).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content include/version.h; `
|
||||
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\win32\project; `
|
||||
set CL=/MP; `
|
||||
nmake /S -f Makefile `
|
||||
CPU=$env:CPU_MODEL `
|
||||
CFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D HAVE_LIBMODBUS_STATIC""" `
|
||||
PCREINCDIR=$env:SystemDrive\pcre_build\build `
|
||||
PCRELIBDIR=$env:SystemDrive\pcre_build\build\Release TLS=openssl `
|
||||
RFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D ZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM""" `
|
||||
# LIBS="Crypt32.lib" `
|
||||
TLSINCDIR=$env:SystemDrive\openssl_output\include `
|
||||
TLSLIBDIR=$env:SystemDrive\openssl_output\lib `
|
||||
MODBINCDIR=$env:SystemDrive\libmodbus\src `
|
||||
MODBLIBDIR=$env:SystemDrive\libmodbus\src\win32\$env:BUILD_ARCH\Release `
|
||||
$env:ZBX_COMPONENT; `
|
||||
`
|
||||
Write-Host 'Verifying build ("zabbix_agent2.exe -V") ...'; `
|
||||
& $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe -V; `
|
||||
dumpbin /dependents $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe; `
|
||||
`
|
||||
New-Item -ItemType directory -Path $env:SystemDrive\zabbix | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:SystemDrive\zabbix\sbin | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:SystemDrive\zabbix\conf | Out-Null; `
|
||||
`
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agentd.exe $env:SystemDrive\zabbix\sbin; `
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_get.exe $env:SystemDrive\zabbix\sbin; `
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_sender.exe $env:SystemDrive\zabbix\sbin; `
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\conf\zabbix_agentd.win.conf $env:SystemDrive\zabbix\conf; `
|
||||
Write-Host 'Zabbix binaries are compiled...';
|
57
Dockerfiles/build-mysql/windows/Dockerfile.agent2
Normal file
57
Dockerfiles/build-mysql/windows/Dockerfile.agent2
Normal file
@ -0,0 +1,57 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# escape=`
|
||||
ARG MAJOR_VERSION=6.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||
ARG BUILD_BASE_IMAGE=zabbix-build-base:ltsc2022-agent2-${ZBX_VERSION}
|
||||
|
||||
FROM ${BUILD_BASE_IMAGE} as builder
|
||||
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
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
|
||||
ARG ZBX_COMPONENT=all
|
||||
ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION
|
||||
|
||||
LABEL org.opencontainers.image.title="Zabbix agent 2 build (Windows)" \
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
org.opencontainers.image.vendor="Zabbix LLC" \
|
||||
org.opencontainers.image.url="https://zabbix.com/" \
|
||||
org.opencontainers.image.description="Zabbix build for agent 2 images based on Windows" \
|
||||
org.opencontainers.image.licenses="GPL v2.0" \
|
||||
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="${ZBX_SOURCES}"
|
||||
|
||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
`
|
||||
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
||||
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Write-Host ('Checkout GIT {0} (master) repository ...' -f $env:ZBX_SOURCES); `
|
||||
git -c advice.detachedHead=false clone $env:ZBX_SOURCES --branch master --depth 1 --single-branch $env:SystemDrive\zabbix-$env:ZBX_VERSION; `
|
||||
`
|
||||
Write-Host ('Building Zabbix {0} version ...' -f $env:ZBX_VERSION); `
|
||||
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION; `
|
||||
$ZbxRevision=(git rev-parse --short HEAD); `
|
||||
(Get-Content src\go\pkg\version\version.go).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content src\go\pkg\version\version.go; `
|
||||
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\mingw; `
|
||||
mingw32-make -s -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 `
|
||||
OPENSSL=$env:SystemDrive\openssl_output `
|
||||
RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM"""; `
|
||||
`
|
||||
Write-Host 'Verifying build ("zabbix_agent2.exe -V") ...'; `
|
||||
& $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe -V; `
|
||||
dumpbin /dependents $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe; `
|
||||
`
|
||||
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; `
|
||||
`
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe $env:SystemDrive\zabbix2\sbin; `
|
||||
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\src\go\conf\zabbix_agent2.win.conf $env:SystemDrive\zabbix2\conf; `
|
||||
Write-Host 'Zabbix binaries are compiled...';
|
Reference in New Issue
Block a user