This repository has been archived by the owner on Jun 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
importing and updating of database, get latest hlxce master
- Loading branch information
Showing
4 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,23 +4,30 @@ ENV HLXCE_VERSION=1_6_19 \ | |
DB_NAME=hlxce \ | ||
DB_USERNAME=hlxce \ | ||
DB_PASSWORD=hlxce \ | ||
DB_HOST=db | ||
DB_HOST=db \ | ||
UPDATE_DB=false | ||
|
||
COPY docker-hlxce-entrypoint /usr/local/bin/ | ||
COPY hlxce.ini /usr/local/etc/php/conf.d/ | ||
|
||
WORKDIR /var/www/html/ | ||
|
||
RUN set -x \ | ||
&& apt-get update && apt-get -y install mysql-client sed libfreetype6-dev libjpeg62-turbo-dev \ | ||
RUN set -xe \ | ||
&& buildDeps=" \ | ||
git \ | ||
" \ | ||
&& apt-get update && apt-get -y install $buildDeps mysql-client sed libfreetype6-dev libjpeg62-turbo-dev --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | ||
&& docker-php-ext-install mysql gd \ | ||
&& chmod +x /usr/local/bin/docker-hlxce-entrypoint \ | ||
&& curl -L https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/downloads/hlxce_${HLXCE_VERSION}.tar.gz -o hlxce.tar.gz \ | ||
&& tar -zxvf hlxce.tar.gz --strip-components=1 web/ \ | ||
&& rm -R updater/ \ | ||
&& rm -rf hlxce.tar.gz \ | ||
&& chown -R www-data:www-data . | ||
&& git clone https://[email protected]/Maverick_of_UC/hlstatsx-community-edition.git hlstatsx \ | ||
&& mv hlstatsx/web/* . \ | ||
&& mv hlstatsx/sql/ . \ | ||
&& rm -R hlstatsx/ \ | ||
&& chown -R www-data:www-data . \ | ||
&& docker-php-source delete \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps | ||
|
||
ENTRYPOINT ["docker-hlxce-entrypoint"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
sed -i "/DB_NAME/s/\"\([^\"]*\)\"/\"${DB_NAME}\"/2g" /var/www/html/config.php | ||
sed -i "/DB_USER/s/\"\([^\"]*\)\"/\"${DB_USERNAME}\"/2g" /var/www/html/config.php | ||
sed -i "/DB_PASS/s/\"\([^\"]*\)\"/\"${DB_PASSWORD}\"/2g" /var/www/html/config.php | ||
sed -i "/DB_ADDR/s/\"\([^\"]*\)\"/\"${DB_HOST}\"/2g" /var/www/html/config.php | ||
|
||
# mysql -h ${DB_ADDR} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < /var/www/html/sql/install.sql | ||
if [ "true" == "$UPDATE_DB" ] | ||
then | ||
while ! mysqladmin ping --host="${DB_HOST}" --user="${DB_USERNAME}" --password="${DB_PASSWORD}" --silent; do | ||
echo 'Waiting for database to come up...' | ||
sleep 2 | ||
done | ||
if [ $(mysql -N -s --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} -e \ | ||
"select count(*) from information_schema.tables where \ | ||
table_schema='${DB_NAME}' and table_name='hlstats_Servers';") -eq 1 ]; then | ||
echo 'Database is already filled' | ||
else | ||
echo 'Importing database tables' | ||
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < /var/www/html/sql/install.sql | ||
fi | ||
rm -R sql/ | ||
else | ||
rm -R updater/ sql/ | ||
fi | ||
|
||
exec "docker-php-entrypoint" $@ | ||
exec "docker-php-entrypoint" $@ |