-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (66 loc) · 2.47 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#FROM ubuntu:20.04
FROM debian:buster
WORKDIR /usr/src/app
# Ensure we don't get asked questions and set container env
ARG DEBIAN_FRONTEND=noninteractive
ENV container docker
# Install everything required for systemd, including dbus, and other utils
# required. nano is for convenience
RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
dbus \
gnupg \
init \
libnss-mdns \
lsb-release \
nano \
systemd \
wget \
&& rm -rf /var/lib/apt/lists/*
# Tonne of stuff we don't want systemd to run in-container
RUN systemctl mask \
dev-hugepages.mount \
sys-fs-fuse-connections.mount \
sys-kernel-config.mount \
display-manager.service \
getty@.service \
systemd-logind.service \
systemd-remount-fs.service \
getty.target \
graphical.target
# Get MySQL, and install it, but remove the default data directory
RUN curl -L -o mysql-apt.deb https://dev.mysql.com/get/mysql-apt-config_0.8.16-1_all.deb \
&& apt install ./mysql-apt.deb \
&& apt update \
&& apt -y install mysql-server \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mysql
# Copy the preconfigured database across, and then ensure we change the config
COPY mysql.tgz /usr/src/app/
RUN printf "[mysqld]\ndefault_authentication_plugin= mysql_native_password" >> /etc/mysql/my.cnf \
&& sed -i $'s/\[mysqld\]/\[mysqld\]\\\nskip-grant-tables/' /etc/mysql/mysql.conf.d/mysqld.cnf
# Get Zabbix release
# Currently skip TLS cert verification, because Zabbix have let their cert expire
RUN curl -k -o zabbix.deb https://repo.zabbix.com/zabbix/5.2/debian/pool/main/z/zabbix-release/zabbix-release_5.2-1+debian10_all.deb \
&& dpkg -i zabbix.deb \
&& apt update \
&& rm -rf /var/lib/apt/lists/*
# Install Zabbix server, agent and web requirements
RUN apt update \
&& apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent \
&& rm -rf /var/lib/apt/lists/*
## Set Zabbix DB password
RUN echo 'DBPassword=zabbix' >> /etc/zabbix/zabbix_server.conf
# Enable the services
RUN systemctl enable mysql zabbix-server zabbix-agent apache2
# Copy entry script
COPY entry.sh /usr/src/app/
# Copy web config for Zabbix
RUN rm -f /usr/share/zabbix/config/zabbix.conf.php
COPY zabbix.conf.php /etc/zabbix/web/
# Ensure stop for systemd is honoured
STOPSIGNAL SIGRTMIN+3
# Start systemd as init
ENTRYPOINT [ "/usr/src/app/entry.sh" ]