2021-09-16 03:15:22 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
2021-09-03 22:46:01 +02:00
|
|
|
# escape=`
|
2022-07-05 14:46:20 +02:00
|
|
|
ARG MAJOR_VERSION=6.4
|
2023-08-22 12:09:29 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.6
|
2021-09-17 22:35:50 +02:00
|
|
|
ARG BUILD_BASE_IMAGE=zabbix-build-agent:ltsc2022-agent2-${ZBX_VERSION}
|
2021-10-16 17:49:19 +02:00
|
|
|
|
2021-09-17 22:35:50 +02:00
|
|
|
ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022
|
2021-09-03 22:46:01 +02:00
|
|
|
|
2021-09-17 22:35:50 +02:00
|
|
|
FROM ${BUILD_BASE_IMAGE} as builder
|
2021-09-03 22:46:01 +02:00
|
|
|
|
|
|
|
FROM $BASE_IMAGE
|
|
|
|
|
2021-09-17 22:35:50 +02:00
|
|
|
ARG MAJOR_VERSION
|
|
|
|
ARG ZBX_VERSION
|
2021-09-03 22:46:01 +02:00
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.title="Zabbix agent 2" `
|
|
|
|
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 agent 2 is deployed on a monitoring target to actively monitor local resources and applications" `
|
2022-12-19 08:52:55 +01:00
|
|
|
org.opencontainers.image.licenses="GPL v2.0, Apache v2.0 for plugins" `
|
2021-09-03 22:46:01 +02:00
|
|
|
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 ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]
|
|
|
|
|
|
|
|
WORKDIR C:\zabbix\
|
|
|
|
|
2021-09-17 22:35:50 +02:00
|
|
|
COPY --from=builder ["C:\\zabbix2", "C:\\zabbix"]
|
2022-12-15 05:37:39 +01:00
|
|
|
COPY --from=builder ["C:\\mongodb_plugin\\zabbix-agent2-plugin-mongodb.exe", "C:\\zabbix\\zabbix-agent2-plugin\\zabbix-agent2-plugin-mongodb.exe"]
|
|
|
|
COPY --from=builder ["C:\\mongodb_plugin\\mongodb.conf", "C:\\zabbix\\conf\\zabbix_agentd.d\\mongodb.conf"]
|
|
|
|
COPY --from=builder ["C:\\postgresql_plugin\\zabbix-agent2-plugin-postgresql.exe", "C:\\zabbix\\zabbix-agent2-plugin\\zabbix-agent2-plugin-postgresql.exe"]
|
|
|
|
COPY --from=builder ["C:\\postgresql_plugin\\postgresql.conf", "C:\\zabbix\\conf\\zabbix_agentd.d\\postgresql.conf"]
|
2021-09-03 22:46:01 +02:00
|
|
|
COPY [".\\docker-entrypoint.ps1", "C:\\zabbix"]
|
|
|
|
|
|
|
|
USER ContainerAdministrator
|
|
|
|
|
2021-09-16 23:07:08 +02:00
|
|
|
RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemDrive) + $env:PATH; `
|
2021-09-16 23:11:04 +02:00
|
|
|
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); `
|
2021-09-16 23:14:49 +02:00
|
|
|
`
|
2021-09-16 23:11:04 +02:00
|
|
|
$env:ZBX_HOME = [string]::Format('{0}\zabbix', $env:SystemDrive); `
|
|
|
|
[Environment]::SetEnvironmentVariable('ZBX_HOME', $env:ZBX_HOME, [EnvironmentVariableTarget]::Machine);
|
2021-09-04 22:57:40 +02:00
|
|
|
|
2021-09-16 23:14:49 +02:00
|
|
|
RUN Set-Location -Path $env:SystemDrive\.; `
|
|
|
|
`
|
2022-12-15 05:37:39 +01:00
|
|
|
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; `
|
|
|
|
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; `
|
|
|
|
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; `
|
|
|
|
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; `
|
2021-09-16 23:14:49 +02:00
|
|
|
`
|
2022-12-15 05:54:48 +01:00
|
|
|
net accounts /MaxPWAge:unlimited; `
|
2022-08-17 11:41:22 +02:00
|
|
|
net user /add zabbix /expire:never /passwordreq:no; `
|
2021-09-16 23:07:08 +02:00
|
|
|
$acl = Get-Acl -Path $env:ZBX_HOME; `
|
2021-09-04 22:57:40 +02:00
|
|
|
$ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); `
|
|
|
|
$acl.AddAccessRule($ace); `
|
2021-09-16 23:07:08 +02:00
|
|
|
Set-Acl -AclObject $acl -Path $env:ZBX_HOME;
|
2021-09-03 22:46:01 +02:00
|
|
|
|
|
|
|
USER zabbix
|
|
|
|
|
|
|
|
EXPOSE 10050/TCP 31999/TCP
|
|
|
|
|
2021-09-16 23:07:08 +02:00
|
|
|
CMD C:\zabbix\docker-entrypoint.ps1 C:\zabbix\sbin\zabbix_agent2.exe -c C:\zabbix\conf\zabbix_agent2.win.conf -f
|