Skip to content

Feature: adding hook to execute additional scripts on startup #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
2 changes: 2 additions & 0 deletions 5.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
WORKDIR /usr/local/mysql
VOLUME /var/lib/mysql

RUN mkdir -p /docker-entrypoint-initdb.d

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Expand Down
9 changes: 9 additions & 0 deletions 5.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if [ ! -d '/var/lib/mysql/mysql' -a "${1%_safe}" = 'mysqld' ]; then
fi
fi

INIT_DIR='/docker-entrypoint-initdb.d'
for f in $INIT_DIR/*.sql
do
if [ -f $f ]; then
echo "Appending sql script: $f"
cat $f >> "$TEMP_FILE"
fi
done

echo 'FLUSH PRIVILEGES ;' >> "$TEMP_FILE"

set -- "$@" --init-file="$TEMP_FILE"
Expand Down
2 changes: 2 additions & 0 deletions 5.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
WORKDIR /usr/local/mysql
VOLUME /var/lib/mysql

RUN mkdir -p /docker-entrypoint-initdb.d

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Expand Down
9 changes: 9 additions & 0 deletions 5.6/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if [ ! -d '/var/lib/mysql/mysql' -a "${1%_safe}" = 'mysqld' ]; then
fi
fi

INIT_DIR='/docker-entrypoint-initdb.d'
for f in $INIT_DIR/*.sql
do
if [ -f $f ]; then
echo "Appending sql script: $f"
cat $f >> "$TEMP_FILE"
fi
done

echo 'FLUSH PRIVILEGES ;' >> "$TEMP_FILE"

set -- "$@" --init-file="$TEMP_FILE"
Expand Down
2 changes: 2 additions & 0 deletions 5.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
WORKDIR /usr/local/mysql
VOLUME /var/lib/mysql

RUN mkdir -p /docker-entrypoint-initdb.d

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Expand Down
9 changes: 9 additions & 0 deletions 5.7/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if [ ! -d '/var/lib/mysql/mysql' -a "${1%_safe}" = 'mysqld' ]; then
fi
fi

INIT_DIR='/docker-entrypoint-initdb.d'
for f in $INIT_DIR/*.sql
do
if [ -f $f ]; then
echo "Appending sql script: $f"
cat $f >> "$TEMP_FILE"
fi
done

echo 'FLUSH PRIVILEGES ;' >> "$TEMP_FILE"

set -- "$@" --init-file="$TEMP_FILE"
Expand Down