0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2024-11-18 02:56:42 +01:00

Merge pull request #65 from nextcloud/volume

Rework Updating
This commit is contained in:
Tilo Spannagel 2017-04-24 20:58:41 +02:00 committed by GitHub
commit 71199bd69a
23 changed files with 557 additions and 29 deletions

View file

@ -1,6 +1,7 @@
FROM php:5.6-apache FROM php:5.6-apache
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -52,9 +53,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:5.6-fpm FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -50,9 +51,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

15
10.0/fpm/apps.config.php Normal file
View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:7.1-apache FROM php:7.1-apache
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -52,9 +53,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:7.1-fpm FROM php:7.1-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -50,9 +51,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

15
11.0/fpm/apps.config.php Normal file
View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:5.6-apache FROM php:5.6-apache
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -52,9 +53,26 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
# only used in nextcloud 9 (assets)
&& mkdir -p /usr/src/nextcloud/assets \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
# only used in nextcloud 9 (assets)
&& chown -R www-data:www-data /usr/src/nextcloud/assets/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:5.6-fpm FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -50,9 +51,26 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
# only used in nextcloud 9 (assets)
&& mkdir -p /usr/src/nextcloud/assets \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
# only used in nextcloud 9 (assets)
&& chown -R www-data:www-data /usr/src/nextcloud/assets/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

15
9.0/fpm/apps.config.php Normal file
View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -1,6 +1,7 @@
FROM php:7.1-%%VARIANT%% FROM php:7.1-%%VARIANT%%
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -52,9 +53,26 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
# only used in nextcloud 9 (assets)
&& mkdir -p /usr/src/nextcloud/assets \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
# only used in nextcloud 9 (assets)
&& chown -R www-data:www-data /usr/src/nextcloud/assets/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["%%CMD%%"] CMD ["%%CMD%%"]

View file

@ -1,6 +1,7 @@
FROM php:5.6-%%VARIANT%% FROM php:5.6-%%VARIANT%%
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
rsync \
bzip2 \ bzip2 \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libfreetype6-dev \ libfreetype6-dev \
@ -52,9 +53,26 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2 && rm nextcloud.tar.bz2 \
&& rm -rf /usr/src/nextcloud/updater \
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
&& mkdir -p /usr/src/nextcloud/data \
&& mkdir -p /usr/src/nextcloud/custom_apps \
# only used in nextcloud 9 (assets)
&& mkdir -p /usr/src/nextcloud/assets \
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
&& chown -R root:www-data /usr/src/nextcloud/ \
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
# only used in nextcloud 9 (assets)
&& chown -R www-data:www-data /usr/src/nextcloud/assets/ \
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
&& chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
COPY apps.config.php /usr/src/nextcloud/config/apps.config.php
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["%%CMD%%"] CMD ["%%CMD%%"]

15
apps.config.php Normal file
View file

@ -0,0 +1,15 @@
<?php
$CONFIG = array (
"apps_paths" => array (
0 => array (
"path" => OC::$SERVERROOT."/apps",
"url" => "/apps",
"writable" => false,
),
1 => array (
"path" => OC::$SERVERROOT."/custom_apps",
"url" => "/custom_apps",
"writable" => true,
),
),
);

View file

@ -1,9 +1,50 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! -e '/var/www/html/version.php' ]; then # version_greater A B returns whether A > B
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - function version_greater() {
chown -R www-data /var/www/html [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]];
}
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before
fi
rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/
if [ ! -d /var/www/html/config ]; then
cp -arT /usr/src/nextcloud/config /var/www/html/config
fi
if [ ! -d /var/www/html/data ]; then
cp -arT /usr/src/nextcloud/data /var/www/html/data
fi
if [ ! -d /var/www/html/custom_apps ]; then
cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps
cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php
fi
if [ "$installed_version" != "0.0.0~unknown" ]; then
su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'
su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after
echo "The following apps have beed disabled:"
diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after
fi
fi fi
exec "$@" exec "$@"

View file

@ -43,9 +43,17 @@ for latest in "${latests[@]}"; do
sed -ri -e '/a2enmod/d' "$version/$variant/Dockerfile" sed -ri -e '/a2enmod/d' "$version/$variant/Dockerfile"
fi fi
# Remove the assets folder if version >= 10.0
if version_greater_or_equal "$version" "10.0"; then
sed -ri -e '/assets/d' "$version/$variant/Dockerfile"
fi
# Copy the docker-entrypoint. # Copy the docker-entrypoint.
cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh" cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh"
# Copy apps.config.php
cp apps.config.php "$version/$variant/apps.config.php"
travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv" travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv"
done done
done done