zabbix-server/Dockerfile
2022-09-13 13:53:15 +05:00

65 lines
1.9 KiB
Docker

FROM debian:11-slim
# 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
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
# Initial update repo and upgrade packges
RUN apt update -y \
&& apt upgrade -y \
&& apt auto-remove -y \
&& apt clean -y
# Language setup
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
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
RUN apt upgrade -y \
&& apt auto-remove -y \
&& apt clean -y
COPY startservices.sh .
RUN chmod +x startservices.sh
# Delete default config files, these will be mounted when running container
RUN rm -v /etc/nginx/sites-enabled/default
RUN rm -v /usr/share/zabbix/conf/zabbix.conf.php
# symlink frontend configs to /etc/zabbix
RUN ln -sv /etc/zabbix/web/zabbix.conf.php /usr/share/zabbix/conf/zabbix.conf.php
#Create dirs and give permission for php and zabbix pid
RUN mkdir /run/php/
RUN mkdir /run/zabbix/
RUN chmod 777 /run/zabbix/
#Start Services
CMD ["./startservices.sh"]