63 lines
2.8 KiB
Docker
63 lines
2.8 KiB
Docker
# 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
|
|
RUN groupadd -r mysql && useradd -r -g mysql mysql
|
|
|
|
RUN mkdir /docker-entrypoint-initdb.d
|
|
|
|
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
|
|
# File::Basename
|
|
# File::Copy
|
|
# Sys::Hostname
|
|
# Data::Dumper
|
|
RUN apt-get update && apt-get install -y perl pwgen git openssh-client --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
|
|
|
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
|
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
|
|
|
ENV MYSQL_MAJOR 5.6
|
|
ENV MYSQL_VERSION 5.6.29-1debian8
|
|
|
|
RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
|
|
|
|
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
|
|
# also, we set debconf keys to make APT a little quieter
|
|
RUN { \
|
|
echo mysql-community-server mysql-community-server/data-dir select ''; \
|
|
echo mysql-community-server mysql-community-server/root-pass password ''; \
|
|
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
|
|
echo mysql-community-server mysql-community-server/remove-test-db select false; \
|
|
} | debconf-set-selections \
|
|
&& apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \
|
|
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql
|
|
|
|
# comment out a few problematic configuration values
|
|
# don't reverse lookup hostnames, they are usually another container
|
|
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
|
|
&& echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
|
|
&& mv /tmp/my.cnf /etc/mysql/my.cnf
|
|
|
|
VOLUME /var/lib/mysql
|
|
|
|
COPY docker-entrypoint.sh /entrypoint.sh
|
|
COPY pandora.cnf /etc/mysql/conf.d
|
|
COPY pandora_initdb.sh /docker-entrypoint-initdb.d
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
# Make ssh dir
|
|
RUN mkdir /root/.ssh/
|
|
# Copy over private key, and set permissions
|
|
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
|
|
RUN chown -R root:root /root/.ssh
|
|
|
|
|
|
#Clone the repo
|
|
RUN git config --global http.sslVerify false
|
|
RUN git clone -b develop --single-branch https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
|
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb.sql /docker-entrypoint-initdb.d
|
|
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb_data.sql /docker-entrypoint-initdb.d
|
|
|
|
EXPOSE 3306
|
|
CMD ["mysqld"]
|