zabbix-server/Dockerfile

65 lines
1.9 KiB
Docker
Raw Normal View History

2022-09-12 15:18:54 +05:00
FROM debian:11-slim
2022-09-13 11:27:35 +05:00
# Zabbix Repo packge URL
# obtain it from: https://www.zabbix.com/download?zabbix=6.2&os_distribution=debian&os_version=11&components=server_frontend_agent&db=mysql&ws=nginx
2022-09-12 15:18:54 +05:00
ARG ZABBIX_URL=https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-3%2Bdebian11_all.deb
WORKDIR /app
RUN chmod 777 /app
2022-09-13 11:27:35 +05:00
# Initial update repo and upgrade packges
RUN apt update -y \
&& apt upgrade -y \
&& apt auto-remove -y \
&& apt clean -y
# Language setup
2022-09-12 15:18:54 +05:00
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
2022-09-13 11:27:35 +05:00
RUN apt install locales -y \
&& apt auto-remove -y \
&& apt clean -y
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
# Installing basic tools
RUN apt install ca-certificates wget curl nano vim -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
# Installing Zabbix repo for zabbix tools
RUN wget $ZABBIX_URL \
&& dpkg -i zabbix-release*.deb \
&& rm -v zabbix-release*.deb
# Installing php, nginx and zabbix ## DO NOT CHANGE INSTALL ODER OF THIS, IT WILL INSTALL APACHE2 AND NIGNX IF YOU DO SO!!!
RUN apt update -y \
&& apt install php php-fpm -y --no-install-recommends \
&& apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
# Final clean up
2022-09-13 13:53:15 +05:00
RUN apt upgrade -y \
2022-09-13 11:27:35 +05:00
&& apt auto-remove -y \
&& apt clean -y
2022-09-12 15:18:54 +05:00
COPY startservices.sh .
RUN chmod +x startservices.sh
2022-09-13 11:27:35 +05:00
# Delete default config files, these will be mounted when running container
2022-09-12 15:50:58 +05:00
RUN rm -v /etc/nginx/sites-enabled/default
RUN rm -v /usr/share/zabbix/conf/zabbix.conf.php
2022-09-13 11:27:35 +05:00
# symlink frontend configs to /etc/zabbix
2022-09-12 15:50:58 +05:00
RUN ln -sv /etc/zabbix/web/zabbix.conf.php /usr/share/zabbix/conf/zabbix.conf.php
2022-09-13 11:27:35 +05:00
#Create dirs and give permission for php and zabbix pid
2022-09-12 15:18:54 +05:00
RUN mkdir /run/php/
2022-09-12 16:12:22 +05:00
RUN mkdir /run/zabbix/
2022-09-12 16:20:23 +05:00
RUN chmod 777 /run/zabbix/
2022-09-13 11:27:35 +05:00
2022-09-12 15:18:54 +05:00
#Start Services
CMD ["./startservices.sh"]