zabbix-docker/proxy-sqlite3/alpine/Dockerfile

118 lines
3.9 KiB
Docker
Raw Normal View History

2017-03-11 23:13:50 +01:00
FROM alpine:3.4
2017-04-27 18:32:34 +02:00
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
2016-08-03 10:09:49 +02:00
ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ARG DB_TYPE=sqlite3
ENV TERM=xterm
2016-10-25 01:49:30 +02:00
ENV MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
2016-08-03 10:09:49 +02:00
RUN addgroup zabbix && \
adduser -S \
-D -G zabbix \
-h /var/lib/zabbix/ \
zabbix && \
mkdir -p /etc/zabbix/ && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/enc && \
mkdir -p /var/lib/zabbix/modules && \
mkdir -p /var/lib/zabbix/ssh_keys && \
mkdir -p /var/lib/zabbix/ssl && \
mkdir -p /var/lib/zabbix/ssl/certs && \
mkdir -p /var/lib/zabbix/ssl/keys && \
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
chown --quiet -R zabbix:root /var/lib/zabbix && \
mkdir -p /usr/lib/zabbix/externalscripts && \
apk update && \
apk add ${APK_FLAGS_PERSISTANT} \
2017-05-25 18:19:08 +02:00
iputils \
2016-08-03 10:09:49 +02:00
supervisor \
bash \
sqlite-libs \
fping \
libxml2 \
unixodbc \
net-snmp-agent-libs \
libldap \
libcurl \
openipmi-libs \
2017-03-11 23:51:18 +01:00
libevent \
2017-05-10 22:27:50 +02:00
pcre \
2016-08-03 10:09:49 +02:00
libssh2 && \
rm -rf /var/cache/apk/*
2016-10-28 16:09:29 +02:00
ARG MAJOR_VERSION=3.4
2017-10-12 19:33:53 +02:00
ARG ZBX_VERSION=${MAJOR_VERSION}.2
2017-08-22 11:42:14 +02:00
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
2016-08-03 10:09:49 +02:00
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE}
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \
coreutils \
automake \
autoconf \
sqlite-dev \
libxml2-dev \
unixodbc-dev \
net-snmp-dev \
libssh2-dev \
openipmi-dev \
openldap-dev \
curl-dev \
2017-03-11 23:51:18 +01:00
libevent-dev \
2017-05-10 22:27:50 +02:00
pcre-dev \
2016-08-03 10:09:49 +02:00
subversion && \
cd /tmp/ && \
svn --quiet export ${ZBX_SOURCES} zabbix-${ZBX_VERSION} 1>/dev/null && \
cd /tmp/zabbix-${ZBX_VERSION} && \
zabbix_revision=`svn info ${ZBX_SOURCES} |grep "Last Changed Rev"|awk '{print $4;}'` && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \
./bootstrap.sh 1>/dev/null && \
export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \
2016-08-03 10:09:49 +02:00
./configure \
--prefix=/usr \
--silent \
--sysconfdir=/etc/zabbix \
--libdir=/usr/lib/zabbix \
--datadir=/usr/lib \
2016-08-03 10:09:49 +02:00
--enable-proxy \
--enable-ipv6 \
# Does not support stable iksemel library
# --with-jabber \
--with-ldap \
--with-net-snmp \
--with-openipmi \
--with-ssh2 \
--with-libcurl \
--with-unixodbc \
--with-libxml2 \
--with-openssl \
--with-${DB_TYPE} && \
make -j"$(nproc)" -s dbschema 1>/dev/null && \
make -j"$(nproc)" -s 1>/dev/null && \
cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
2016-08-03 10:09:49 +02:00
cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \
chown --quiet -R zabbix:root /etc/zabbix && \
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apk del ${APK_FLAGS_COMMON} --purge \
build-dependencies && \
rm -rf /var/cache/apk/*
EXPOSE 10051/TCP 162/UDP
WORKDIR /var/lib/zabbix
VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"]
2016-08-03 14:23:39 +02:00
VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"]
2016-08-03 10:09:49 +02:00
ADD conf/etc/supervisor/ /etc/supervisor/
2016-08-04 07:09:11 +02:00
ADD run_zabbix_component.sh /
2016-08-03 10:09:49 +02:00
ENTRYPOINT ["/bin/bash"]
2016-08-04 07:09:11 +02:00
CMD ["/run_zabbix_component.sh", "proxy", "sqlite3"]