Added default MYSQL_DATABASE environment variable

(cherry picked from commit 689a867f3b)
This commit is contained in:
axl89 2016-08-12 13:02:57 +02:00
parent c58bc9e365
commit 7fa7016fca
1 changed files with 8 additions and 3 deletions

View File

@ -2,8 +2,13 @@ FROM mysql:5.5
MAINTAINER Pandora FMS Team <info@pandorafms.com> MAINTAINER Pandora FMS Team <info@pandorafms.com>
WORKDIR /pandorafms/pandora_console WORKDIR /pandorafms/pandora_console
ADD pandoradb.sql /docker-entrypoint-initdb.d ADD pandoradb.sql /docker-entrypoint-initdb.d
ADD pandoradb_data.sql /docker-entrypoint-initdb.d ADD pandoradb_data.sql /docker-entrypoint-initdb.d
RUN /bin/bash -c 'echo "CREATE DATABASE pandora" > /docker-entrypoint-initdb.d/create_pandoradb.sql'
RUN /bin/bash -c 'sed -i "1iUSE pandora" /docker-entrypoint-initdb.d/pandoradb.sql' ENV MYSQL_DATABASE=pandora
RUN /bin/bash -c 'sed -i "1iUSE pandora" /docker-entrypoint-initdb.d/pandoradb_data.sql'
RUN echo " \n\
sed -i \"1iUSE \$MYSQL_DATABASE\" /docker-entrypoint-initdb.d/pandoradb.sql \n\
sed -i \"1iUSE \$MYSQL_DATABASE\" /docker-entrypoint-initdb.d/pandoradb_data.sql \n\
" >> /docker-entrypoint-initdb.d/create_pandoradb.sh