diff --git a/extras/Dockerfile b/extras/Dockerfile index fcd39254fb..8f27c730b8 100644 --- a/extras/Dockerfile +++ b/extras/Dockerfile @@ -1,3 +1,4 @@ +# Dockerfile for the Pandora FMS image. FROM debian:jessie # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added diff --git a/extras/docker/Dockerfile b/extras/docker/Dockerfile new file mode 100644 index 0000000000..5ffe12f2d5 --- /dev/null +++ b/extras/docker/Dockerfile @@ -0,0 +1,50 @@ +FROM pandorafms/pandorafms-base + +# Build variables. +ARG BRANCH=develop +ARG DB_PASS=pandora + +# Clone the Pandora FMS repo. +RUN git clone --depth 1 -b "$BRANCH" https://github.com/pandorafms/pandorafms.git /tmp/pandorafms + +# Install the Pandora FMS Server. +RUN cd /tmp/pandorafms/pandora_server && \ +yes | ./pandora_server_installer --install && \ +sed -i "s/^dbuser.*/dbuser root/" /etc/pandora/pandora_server.conf && \ +sed -i "s/^dbpass.*/dbpass $DB_PASS/" /etc/pandora/pandora_server.conf + +# Install the Pandora FMS Agent. +RUN cd /tmp/pandorafms/pandora_agents/unix && \ +./pandora_agent_installer --install + +# Set the server's name in Apache's configuration file to avoid warnings. +RUN sed -i "s/#ServerName.*/ServerName localhost:80/" /etc/httpd/conf/httpd.conf + +# Install the Pandora FMS Console. +RUN service mysqld start && \ +/usr/bin/mysqladmin -u root password "$DB_PASS" && \ +service httpd start && \ +cp -r /tmp/pandorafms/pandora_console /var/www/html && \ +chown -R apache.apache /var/www/html/pandora_console/ && \ +python /tmp/pandorafms/tests/install_console.py + +# Redirect HTTP requests to / to the Pandora FMS Console. +RUN echo '' > /var/www/html/index.html + +# Create the entrypoint script. +RUN echo -e '#/bin/bash\n \ +service mysqld start &&\n \ +service httpd start &&\n \ +service crond start &&\n \ +/etc/init.d/pandora_agent_daemon start && \ +/etc/init.d/pandora_server start && \ +tail -f /var/log/pandora/pandora_server.log' \ +>> /entrypoint.sh && \ +chmod +x /entrypoint.sh + +# Clean-up. +RUN rm -rf /tmp/pandorafms +RUN yum clean all + +EXPOSE 80 3306 41121 +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/extras/docker/build_and_push.sh b/extras/docker/build_and_push.sh new file mode 100755 index 0000000000..980087cfe5 --- /dev/null +++ b/extras/docker/build_and_push.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build --rm=true --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ +docker push pandorafms/pandorafms:7