diff --git a/Dockerfile.template b/Dockerfile.template index ef00e96..c69e5cb 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/docker-run.sh b/docker-run.sh index 0a60ff6..5f238e4 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -197,12 +197,14 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then continue fi echo "Load demo data ${fileSQL} ..." + sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi @@ -257,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/15.0.3-php7.4/Dockerfile b/images/15.0.3-php7.4/Dockerfile index 74d3a01..53590de 100644 --- a/images/15.0.3-php7.4/Dockerfile +++ b/images/15.0.3-php7.4/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/15.0.3-php7.4/docker-run.sh b/images/15.0.3-php7.4/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/15.0.3-php7.4/docker-run.sh +++ b/images/15.0.3-php7.4/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/16.0.5-php8.1/Dockerfile b/images/16.0.5-php8.1/Dockerfile index 551fff6..66dbcf1 100644 --- a/images/16.0.5-php8.1/Dockerfile +++ b/images/16.0.5-php8.1/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/16.0.5-php8.1/docker-run.sh b/images/16.0.5-php8.1/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/16.0.5-php8.1/docker-run.sh +++ b/images/16.0.5-php8.1/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/17.0.4-php8.1/Dockerfile b/images/17.0.4-php8.1/Dockerfile index 425db8e..83881f9 100644 --- a/images/17.0.4-php8.1/Dockerfile +++ b/images/17.0.4-php8.1/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/17.0.4-php8.1/docker-run.sh b/images/17.0.4-php8.1/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/17.0.4-php8.1/docker-run.sh +++ b/images/17.0.4-php8.1/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/18.0.5-php8.1/Dockerfile b/images/18.0.5-php8.1/Dockerfile index d6480a3..5b3ef72 100644 --- a/images/18.0.5-php8.1/Dockerfile +++ b/images/18.0.5-php8.1/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/18.0.5-php8.1/docker-run.sh b/images/18.0.5-php8.1/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/18.0.5-php8.1/docker-run.sh +++ b/images/18.0.5-php8.1/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/19.0.2-php8.2/Dockerfile b/images/19.0.2-php8.2/Dockerfile index 2351c94..01922ec 100644 --- a/images/19.0.2-php8.2/Dockerfile +++ b/images/19.0.2-php8.2/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/19.0.2-php8.2/docker-run.sh b/images/19.0.2-php8.2/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/19.0.2-php8.2/docker-run.sh +++ b/images/19.0.2-php8.2/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi diff --git a/images/develop/Dockerfile b/images/develop/Dockerfile index 51c7e91..edbce81 100644 --- a/images/develop/Dockerfile +++ b/images/develop/Dockerfile @@ -81,6 +81,8 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar. rm -rf /tmp/* && \ mkdir -p /var/www/documents && \ mkdir -p /var/www/html/custom && \ + mkdir -p /var/www/dev && \ + cp -r /tmp/dolibarr-${DOLI_VERSION}/dev/initdemo /var/www/dev && \ chown -R www-data:www-data /var/www EXPOSE 80 diff --git a/images/develop/docker-run.sh b/images/develop/docker-run.sh index cc8977a..5f238e4 100755 --- a/images/develop/docker-run.sh +++ b/images/develop/docker-run.sh @@ -197,6 +197,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES ('SYSTEMTOOLS_MYSQLDUMP', '/usr/bin/mysqldump', 'chaine', 0, '', 0);" > /dev/null 2>&1 if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then + echo "Load demo data ..." for fileSQL in /var/www/dev/initdemo/*.sql; do # We exclude the old load file. if [[ $fileSQL =~ mysqldump_dolibarr_3.5 ]]; then @@ -207,7 +208,7 @@ function initializeDatabase() mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 done fi - + echo "Enable user module ..." php /var/www/scripts/docker-init.php @@ -258,25 +259,30 @@ function run() echo "Current Version is : ${DOLI_VERSION}" # If install of mysql database (and not install of cron) is requested - if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then - waitForDataBase - - mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 - r=$? - if [[ ${r} -ne 0 ]]; then - initializeDatabase - else - INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` - echo "Last installed Version is : ${INSTALLED_VERSION}" - if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then - migrateDatabase + if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ${DOLI_DB_TYPE} != "pgsql" ]]; then + echo "DOLI_INSTALL_AUTO is on, so we check to initialize or upgrade mariadb database" + if [[ ! -f /var/www/documents/install.lock ]]; then + waitForDataBase + + mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1 + r=$? + if [[ ${r} -ne 0 ]]; then + initializeDatabase else - echo "Schema update is not required ... Enjoy !!" + INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result` + echo "Last installed Version is : ${INSTALLED_VERSION}" + if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then + migrateDatabase + else + echo "Schema update is not required ... Enjoy !!" + fi fi - fi - if [[ ${DOLI_VERSION} != "develop" ]]; then - lockInstallation + if [[ ${DOLI_VERSION} != "develop" ]]; then + lockInstallation + fi + else + echo "File /var/www/documents/install.lock exists so we cancel database init" fi fi