optimized Dockerfile
This commit is contained in:
parent
569c5b84d7
commit
68326a760c
59
Dockerfile
59
Dockerfile
@ -1,38 +1,65 @@
|
|||||||
FROM debian:11-slim
|
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
|
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
|
WORKDIR /app
|
||||||
RUN chmod 777 /app
|
RUN chmod 777 /app
|
||||||
|
|
||||||
RUN apt update -y
|
# Initial update repo and upgrade packges
|
||||||
RUN apt upgrade -y
|
RUN apt update -y \
|
||||||
RUN apt install locales -y
|
&& apt upgrade -y \
|
||||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
&& apt auto-remove -y \
|
||||||
|
&& apt clean -y
|
||||||
|
|
||||||
|
# Language setup
|
||||||
ENV LANG en_US.UTF-8
|
ENV LANG en_US.UTF-8
|
||||||
ENV LANGUAGE en_US:en
|
ENV LANGUAGE en_US:en
|
||||||
ENV LC_ALL en_US.UTF-8
|
ENV LC_ALL en_US.UTF-8
|
||||||
RUN apt install ca-certificates wget curl neofetch nano vim -y --no-install-recommends
|
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
|
||||||
|
|
||||||
RUN wget $ZABBIX_URL
|
# Installing basic tools
|
||||||
RUN dpkg -i zabbix-release*.deb
|
RUN apt install ca-certificates wget curl nano vim -y --no-install-recommends \
|
||||||
RUN rm zabbix-release*.deb
|
&& apt auto-remove -y \
|
||||||
RUN apt update -y
|
&& apt clean -y
|
||||||
RUN apt install php php-fpm -y --no-install-recommends
|
|
||||||
RUN apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts -y --no-install-recommends
|
# Installing Zabbix repo for zabbix tools
|
||||||
#RUN apt purge mysql* mariadb* -y
|
RUN wget $ZABBIX_URL \
|
||||||
RUN apt auto-remove -y
|
&& dpkg -i zabbix-release*.deb \
|
||||||
RUN apt update -y
|
&& rm -v zabbix-release*.deb
|
||||||
RUN apt upgrade -y
|
|
||||||
|
# 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 update -y \
|
||||||
|
&& apt upgrade -y \
|
||||||
|
&& apt auto-remove -y \
|
||||||
|
&& apt clean -y
|
||||||
|
|
||||||
COPY startservices.sh .
|
COPY startservices.sh .
|
||||||
RUN chmod +x 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 /etc/nginx/sites-enabled/default
|
||||||
RUN rm -v /usr/share/zabbix/conf/zabbix.conf.php
|
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
|
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/php/
|
||||||
RUN mkdir /run/zabbix/
|
RUN mkdir /run/zabbix/
|
||||||
RUN chmod 777 /run/zabbix/
|
RUN chmod 777 /run/zabbix/
|
||||||
|
|
||||||
#Start Services
|
#Start Services
|
||||||
CMD ["./startservices.sh"]
|
CMD ["./startservices.sh"]
|
||||||
|
@ -2,7 +2,7 @@ version: '3.5'
|
|||||||
services:
|
services:
|
||||||
#########################
|
#########################
|
||||||
zabbix:
|
zabbix:
|
||||||
# build: .
|
build: .
|
||||||
image: zabbix
|
image: zabbix
|
||||||
volumes:
|
volumes:
|
||||||
- $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf
|
- $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user