From 63a61cf81806f5ea2236f6faaaa4e0baffb6a7a8 Mon Sep 17 00:00:00 2001 From: Alex Phillips Date: Thu, 9 Sep 2021 17:47:38 -0400 Subject: [PATCH] overlay-fs bug workaround - move to tmp location then move and chown on init --- Dockerfile | 4 +++- Dockerfile.aarch64 | 4 +++- Dockerfile.armhf | 4 +++- root/etc/cont-init.d/50-config | 9 ++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 33bc0d9..3f64736 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,6 +53,8 @@ RUN \ /var/www/html/ --strip-components=1 && \ echo "**** install composer dependencies ****" && \ composer install -d /var/www/html/ && \ + echo "**** overlay-fs bug workaround ****" && \ + mv /var/www /var/www-tmp && \ echo "**** cleanup ****" && \ rm -rf \ /root/.composer \ @@ -61,4 +63,4 @@ RUN \ COPY root/ / VOLUME /config -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 201c014..3ae42f0 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -53,6 +53,8 @@ RUN \ /var/www/html/ --strip-components=1 && \ echo "**** install composer dependencies ****" && \ composer install -d /var/www/html/ && \ + echo "**** overlay-fs bug workaround ****" && \ + mv /var/www /var/www-tmp && \ echo "**** cleanup ****" && \ rm -rf \ /root/.composer \ @@ -61,4 +63,4 @@ RUN \ COPY root/ / VOLUME /config -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/Dockerfile.armhf b/Dockerfile.armhf index d42b146..a380eaa 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -53,6 +53,8 @@ RUN \ /var/www/html/ --strip-components=1 && \ echo "**** install composer dependencies ****" && \ composer install -d /var/www/html/ && \ + echo "**** overlay-fs bug workaround ****" && \ + mv /var/www /var/www-tmp && \ echo "**** cleanup ****" && \ rm -rf \ /root/.composer \ @@ -61,4 +63,4 @@ RUN \ COPY root/ / VOLUME /config -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 2c0558a..92b951d 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -1,5 +1,11 @@ #!/usr/bin/with-contenv bash +if [ -d /var/www-tmp ]; then + echo "New container detected. Setting up app folder and fixing permissions." + mv /var/www-tmp /var/www + chown -R abc:abc /var/www +fi + # create directory structure mkdir -p \ /config/www/{uploads,files,images} @@ -108,8 +114,5 @@ fi chown -R abc:abc \ /config -find /var/www -print0 | xargs -P "$(nproc)" -I {} -0 chown -h abc:abc {} -find /var/www -print0 -type d | xargs -P "$(nproc)" -I {} -0 chown -h abc:abc {} - # set lockfile to avoid DB waits for this specific container touch /dbwait.lock