improve DB init/update to avoid false error messages
authorThomas Bruederli <redacted>
Sun, 6 Mar 2022 21:00:15 +0000 (22:00 +0100)
committerThomas Bruederli <redacted>
Sun, 6 Mar 2022 21:00:15 +0000 (22:00 +0100)
apache/Dockerfile
apache/docker-entrypoint.sh
fpm-alpine/Dockerfile
fpm-alpine/docker-entrypoint.sh
fpm/Dockerfile
fpm/docker-entrypoint.sh
templates/Dockerfile-alpine.templ
templates/Dockerfile-debian.templ
templates/docker-entrypoint.sh

index 319759160a255362d849188c3cc8d06ba944405c..37640e93be27f9666027b530d4dd76fa1064e1b4 100644 (file)
@@ -102,6 +102,9 @@ RUN set -ex; \
        rm -rf /usr/src/roundcubemail/installer; \
        chown -R www-data:www-data /usr/src/roundcubemail/logs
 
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
 # include the wait-for-it.sh script
 RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
 
index 50afaa656cbccc53b7eb8dfec73104e480984c38..39379453b040eccf2824a15601197de3ab140e18 100755 (executable)
@@ -121,7 +121,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   done
 
   # initialize or update DB
-  bin/initdb.sh --dir=$PWD/SQL --create || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize database. Please run $PWD/bin/initdb.sh and $PWD/bin/updatedb.sh manually."
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
 
   if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
     mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
index 08fc22d79f090d318f882c7b73002100989c8b98..dcaf64106c91863863c23c98b781dc5a19daaee9 100644 (file)
@@ -94,6 +94,9 @@ RUN set -ex; \
        chown -R www-data:www-data /usr/src/roundcubemail/logs; \
        apk del .fetch-deps
 
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
 # include the wait-for-it.sh script
 RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
 
index 50afaa656cbccc53b7eb8dfec73104e480984c38..39379453b040eccf2824a15601197de3ab140e18 100755 (executable)
@@ -121,7 +121,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   done
 
   # initialize or update DB
-  bin/initdb.sh --dir=$PWD/SQL --create || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize database. Please run $PWD/bin/initdb.sh and $PWD/bin/updatedb.sh manually."
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
 
   if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
     mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
index 62e093944360c0972f9ff4d6c51db49b52555824..2c7f25e0d66d60fb38edbd72d69ccbdfcb35eb2f 100644 (file)
@@ -101,13 +101,16 @@ RUN set -ex; \
        rm -rf /usr/src/roundcubemail/installer; \
        chown -R www-data:www-data /usr/src/roundcubemail/logs
 
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
 # include the wait-for-it.sh script
 RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
 
 # use custom PHP settings
 COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
 
-COPY docker-entrypoint.sh /
+COPY --chmod=0755 docker-entrypoint.sh /
 
 ENTRYPOINT ["/docker-entrypoint.sh"]
 CMD ["php-fpm"]
index 50afaa656cbccc53b7eb8dfec73104e480984c38..39379453b040eccf2824a15601197de3ab140e18 100755 (executable)
@@ -121,7 +121,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   done
 
   # initialize or update DB
-  bin/initdb.sh --dir=$PWD/SQL --create || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize database. Please run $PWD/bin/initdb.sh and $PWD/bin/updatedb.sh manually."
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
 
   if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
     mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
index 7a9bacc3dd157c2610a8818b815e840b2384650f..151eba160c1e989f926107f08f479290a601ccba 100644 (file)
@@ -94,13 +94,16 @@ RUN set -ex; \
        chown -R www-data:www-data /usr/src/roundcubemail/logs; \
        apk del .fetch-deps
 
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
 # include the wait-for-it.sh script
 RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
 
 # use custom PHP settings
 COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
 
-COPY docker-entrypoint.sh /
+COPY --chmod=0755 docker-entrypoint.sh /
 
 ENTRYPOINT ["/docker-entrypoint.sh"]
 CMD ["%%CMD%%"]
index 905e78f2ebc7452ab1a3784c0042af2b0488bd2e..02f12a8ac867bccf7c1ce0aa98f4e8c087d13322 100644 (file)
@@ -101,13 +101,16 @@ RUN set -ex; \
        rm -rf /usr/src/roundcubemail/installer; \
        chown -R www-data:www-data /usr/src/roundcubemail/logs
 
+# copy the latest version of initdb.sh which supports the --update flag
+RUN curl -fL https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/initdb.sh > /usr/src/roundcubemail/bin/initdb.sh && chmod +x /usr/src/roundcubemail/bin/initdb.sh
+
 # include the wait-for-it.sh script
 RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh
 
 # use custom PHP settings
 COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini
 
-COPY docker-entrypoint.sh /
+COPY --chmod=0755 docker-entrypoint.sh /
 
 ENTRYPOINT ["/docker-entrypoint.sh"]
 CMD ["%%CMD%%"]
index 50afaa656cbccc53b7eb8dfec73104e480984c38..39379453b040eccf2824a15601197de3ab140e18 100644 (file)
@@ -121,7 +121,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
   done
 
   # initialize or update DB
-  bin/initdb.sh --dir=$PWD/SQL --create || bin/updatedb.sh --dir=$PWD/SQL --package=roundcube || echo "Failed to initialize database. Please run $PWD/bin/initdb.sh and $PWD/bin/updatedb.sh manually."
+  bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
 
   if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
     mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
git clone https://git.99rst.org/PROJECT