-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-7.0-not
40 lines (39 loc) · 2.21 KB
/
Dockerfile-7.0-not
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
# 使用最新的Ubuntu AMD64镜像作为基础镜像
FROM arm64v8/ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
# COPY sources.list /etc/apt/sources.list
# 安装所需的软件
RUN apt-get update -y && apt-get install -y wget vim locales lsb-release \
# wget https://repo.zabbix.com/zabbix/7.0/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_latest+ubuntu22.04_all.deb
# dpkg -i zabbix-release_latest+ubuntu22.04_all.deb
# apt update
# apt install zabbix-agent2 zabbix-agent2-plugin-*
&& wget https://repo.zabbix.com/zabbix/7.0/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_latest+ubuntu22.04_all.deb \
&& dpkg -i zabbix-release_latest+ubuntu22.04_all.deb \
&& apt-get update -y \
&& apt-get install -y unzip mysql-server php php-mysql apache2 zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent2 zabbix-agent2-plugin-* \
&& usermod -d /var/lib/mysql/ mysql \
&& locale-gen en_US.UTF-8 \
&& update-locale
COPY my.cnf /etc/mysql/my.cnf
COPY zabbix_server.conf /etc/zabbix/zabbix_server.conf
COPY zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf
COPY apache.conf /etc/zabbix/apache.conf
COPY php.ini /etc/php/8.1/apache2/php.ini
# COPY server.sql /.
COPY server.sql.zip /.
# 配置MySQL
RUN unzip /server.sql.zip && rm -f /server.sql.zip \
&& sed -i 's/bind-address/#bind-address/' /etc/mysql/mysql.conf.d/mysqld.cnf \
&& service mysql restart && mysql -e "create database zabbix character set utf8mb4 collate utf8mb4_bin;" \
&& service mysql restart && mysql -e "create user zabbix@localhost identified by 'password';" \
&& service mysql restart && mysql -e "grant all privileges on zabbix.* to zabbix@localhost;" \
&& service mysql restart && mysql -e "set global log_bin_trust_function_creators = 1;" \
&& service mysql restart && mysql -e "FLUSH PRIVILEGES;" \
&& service mysql restart && mysql -e "use zabbix;source /server.sql;update dbversion set mandatory=7000000;FLUSH PRIVILEGES;" \
&& service mysql restart \
&& cp -r /usr/share/zabbix/ /var/www/html/
# 暴露Zabbix Frontend端口
EXPOSE 80 3306 11050
# 启动Apache2和Zabbix Agent
CMD service mysql restart && service zabbix-server restart && service apache2 restart && service zabbix-agent2 restart && tail -f /dev/null