mirror of
https://github.com/nextcloud/docker.git
synced 2025-03-15 19:05:09 +01:00
Merge pull request #2 from nextcloud/master
Merge master back from official one
This commit is contained in:
commit
230bb49370
135 changed files with 3221 additions and 1164 deletions
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Examples section
|
# Examples section
|
||||||
|
|
||||||
In this subfolders are some examples how to use the docker image. There are two sections:
|
In this subfolders are some examples how to use the docker image. There are two sections:
|
||||||
|
|
||||||
* [`dockerfiles`](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles)
|
* [`dockerfiles`](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles)
|
||||||
* [`docker-compose`](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose)
|
* [`docker-compose`](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ The Dockerfiles use the default images as base image and build on top of it.
|
||||||
|
|
||||||
Example | Description
|
Example | Description
|
||||||
------- | -------
|
------- | -------
|
||||||
[cron](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed).
|
[cron](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed). This image runs `supervisord` to start nextcloud and cron as two seperate processes inside the container.
|
||||||
[imap](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/imap) | adds dependencies required to authenticate users via imap
|
[imap](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/imap) | adds dependencies required to authenticate users via imap
|
||||||
[smb](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/smb) | adds dependencies required to use smb shares
|
[smb](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/smb) | adds dependencies required to use smb shares
|
||||||
[full](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/full) | adds dependencies for ALL optional packages and cron functionality via supervisor (as in the `cron` example Dockerfile).
|
[full](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/full) | adds dependencies for ALL optional packages and cron functionality via supervisor (as in the `cron` example Dockerfile).
|
||||||
|
@ -21,49 +21,48 @@ Example | Description
|
||||||
### full
|
### full
|
||||||
The `full` Dockerfile example adds dependencies for all optional packages suggested by nextcloud that may be needed for some features (e.g. Video Preview Generation), as stated in the [Administration Manual](https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html).
|
The `full` Dockerfile example adds dependencies for all optional packages suggested by nextcloud that may be needed for some features (e.g. Video Preview Generation), as stated in the [Administration Manual](https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html).
|
||||||
|
|
||||||
NOTE: The Dockerfile does not install the LibreOffice package (line is commented), because it would increase the generated Image size by approximately 500 MB. In order to install it, simply uncomment the 13th line of the Dockerfile.</br>
|
NOTE: The Dockerfile does not install the LibreOffice package (line is commented), because it would increase the generated Image size by approximately 500 MB. In order to install it, simply uncomment the 13th line of the Dockerfile.
|
||||||
|
|
||||||
NOTE: Per default, only previews for BMP, GIF, JPEG, MarkDown, MP3, PNG, TXT, and XBitmap Files are generated. The configuration of the preview generation can be done in config.php, as explained in the [Administration Manual](https://docs.nextcloud.com/server/12/admin_manual/configuration_server/config_sample_php_parameters.html#previews)</br>
|
NOTE: Per default, only previews for BMP, GIF, JPEG, MarkDown, MP3, PNG, TXT, and XBitmap Files are generated. The configuration of the preview generation can be done in config.php, as explained in the [Administration Manual](https://docs.nextcloud.com/server/12/admin_manual/configuration_server/config_sample_php_parameters.html#previews)
|
||||||
|
|
||||||
NOTE: Nextcloud recommends [disabling preview generation](https://docs.nextcloud.com/server/12/admin_manual/configuration_server/harden_server.html?highlight=enabledpreviewproviders#disable-preview-image-generation) for high security deployments, as preview generation opens your nextcloud instance to new possible attack vectors.</br>
|
NOTE: Nextcloud recommends [disabling preview generation](https://docs.nextcloud.com/server/12/admin_manual/configuration_server/harden_server.html?highlight=enabledpreviewproviders#disable-preview-image-generation) for high security deployments, as preview generation opens your nextcloud instance to new possible attack vectors.
|
||||||
|
|
||||||
The required steps for each optional/recommended package that is not already in the Nextcloud image are listed here, so that the Dockerfile can easily be modified to only install the needed extra packages. Simply remove the steps for the unwanted packages from the Dockerfile.
|
The required steps for each optional/recommended package that is not already in the Nextcloud image are listed here, so that the Dockerfile can easily be modified to only install the needed extra packages. Simply remove the steps for the unwanted packages from the Dockerfile.
|
||||||
|
|
||||||
#### PHP Module bz2
|
#### PHP Module bz2
|
||||||
`docker-php-ext-install bz2` </br>
|
`docker-php-ext-install bz2`
|
||||||
|
|
||||||
#### PHP Module imagick
|
#### PHP Module imagick
|
||||||
`apt install libmagickwand-dev` </br>
|
`apt install libmagickwand-dev`
|
||||||
`pecl install imagick` </br>
|
`pecl install imagick`
|
||||||
`docker-php-ext-enable imagick` </br>
|
`docker-php-ext-enable imagick`
|
||||||
|
|
||||||
#### PHP Module imap
|
#### PHP Module imap
|
||||||
`apt install libc-client-dev libkrb5-dev` </br>
|
`apt install libc-client-dev libkrb5-dev`
|
||||||
`docker-php-ext-configure imap --with-kerberos --with-imap-ssl` </br>
|
`docker-php-ext-configure imap --with-kerberos --with-imap-ssl`
|
||||||
`docker-php-ext-install imap` </br>
|
`docker-php-ext-install imap`
|
||||||
|
|
||||||
#### PHP Module gmp
|
#### PHP Module gmp
|
||||||
`apt install libgmp3-dev` </br>
|
`apt install libgmp3-dev`
|
||||||
`docker-php-ext-install gmp` </br>
|
`docker-php-ext-install gmp`
|
||||||
|
|
||||||
#### PHP Module smbclient
|
#### PHP Module smbclient
|
||||||
`apt install smbclient libsmbclient-dev` </br>
|
`apt install smbclient libsmbclient-dev`
|
||||||
`pecl install smbclient` </br>
|
`pecl install smbclient`
|
||||||
`docker-php-ext-enable smbclient` </br>
|
`docker-php-ext-enable smbclient`
|
||||||
|
|
||||||
#### ffmpeg
|
#### ffmpeg
|
||||||
`echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list` </br>
|
`apt install ffmpeg`
|
||||||
`apt install ffmpeg` </br>
|
|
||||||
|
|
||||||
#### LibreOffice
|
#### LibreOffice
|
||||||
`apt install LibreOffice` </br>
|
`apt install libreoffice`
|
||||||
|
|
||||||
#### CRON via supervisor
|
#### CRON via supervisor
|
||||||
`apt install supervisor` </br>
|
`apt install supervisor`
|
||||||
`mkdir /var/log/supervisord /var/run/supervisord` </br>
|
`mkdir /var/log/supervisord /var/run/supervisord`
|
||||||
The following Dockerfile commands are also necessary for a sucessfull cron installation: </br>
|
The following Dockerfile commands are also necessary for a sucessfull cron installation:
|
||||||
`COPY supervisord.conf /etc/supervisor/supervisord.conf` </br>
|
`COPY supervisord.conf /etc/supervisor/supervisord.conf`
|
||||||
`CMD ["/usr/bin/supervisord"]` </br>
|
`CMD ["/usr/bin/supervisord"]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,9 +91,12 @@ If you want to update your installation to a newer version of nextcloud, repeat
|
||||||
|
|
||||||
### with-nginx-proxy
|
### with-nginx-proxy
|
||||||
The nginx proxy adds a proxy layer between nextcloud and the internet. The proxy is designed to serve multiple sites on the same host machine.
|
The nginx proxy adds a proxy layer between nextcloud and the internet. The proxy is designed to serve multiple sites on the same host machine.
|
||||||
|
|
||||||
The advantage in adding this layer is the ability to add a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling.
|
The advantage in adding this layer is the ability to add a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling.
|
||||||
This combination of the [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) and [jrcs/docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) containers creates a fully automated https encryption of the nextcloud installation without worrying about certificate generation, validation or renewal.
|
This combination of the [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) and [jrcs/docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) containers creates a fully automated https encryption of the nextcloud installation without worrying about certificate generation, validation or renewal.
|
||||||
|
|
||||||
|
**This setup only works with a valid domain name on a server that is reachable from the internet.**
|
||||||
|
|
||||||
To use this example complete the following steps:
|
To use this example complete the following steps:
|
||||||
|
|
||||||
1. open `docker-compose.yml`
|
1. open `docker-compose.yml`
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -15,7 +16,7 @@ services:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
app:
|
app:
|
||||||
build: ./app
|
build: ./app
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -15,7 +16,7 @@ services:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
app:
|
app:
|
||||||
build: ./app
|
build: ./app
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -50,6 +50,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -121,7 +122,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -140,12 +141,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -11,7 +12,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:apache
|
image: nextcloud:apache
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -11,7 +12,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:fpm
|
image: nextcloud:fpm
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -50,6 +50,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -121,7 +122,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -140,12 +141,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:apache
|
image: nextcloud:apache
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -9,7 +9,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:fpm
|
image: nextcloud:fpm
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -50,6 +50,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -121,7 +122,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -140,12 +141,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
MYSQL_PASSWORD=
|
||||||
|
MYSQL_DATABASE=nextcloud
|
||||||
|
MYSQL_USER=nextcloud
|
|
@ -0,0 +1,78 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=
|
||||||
|
env_file:
|
||||||
|
- db.env
|
||||||
|
|
||||||
|
app:
|
||||||
|
image: nextcloud:fpm
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- nextcloud:/var/www/html
|
||||||
|
environment:
|
||||||
|
- MYSQL_HOST=db
|
||||||
|
env_file:
|
||||||
|
- db.env
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
web:
|
||||||
|
build: ./web
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- nextcloud:/var/www/html:ro
|
||||||
|
environment:
|
||||||
|
- VIRTUAL_HOST=
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
networks:
|
||||||
|
- proxy-tier
|
||||||
|
- default
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
build: ./proxy
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
volumes:
|
||||||
|
- certs:/etc/nginx/certs:ro
|
||||||
|
- vhost.d:/etc/nginx/vhost.d
|
||||||
|
- html:/usr/share/nginx/html
|
||||||
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
|
networks:
|
||||||
|
- proxy-tier
|
||||||
|
depends_on:
|
||||||
|
- omgwtfssl
|
||||||
|
|
||||||
|
omgwtfssl:
|
||||||
|
image: paulczar/omgwtfssl
|
||||||
|
restart: "no"
|
||||||
|
volumes:
|
||||||
|
- certs:/certs
|
||||||
|
environment:
|
||||||
|
- SSL_SUBJECT=servhostname.local
|
||||||
|
- CA_SUBJECT=my@example.com
|
||||||
|
- SSL_KEY=/certs/servhostname.local.key
|
||||||
|
- SSL_CSR=/certs/servhostname.local.csr
|
||||||
|
- SSL_CERT=/certs/servhostname.local.crt
|
||||||
|
networks:
|
||||||
|
- proxy-tier
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
|
nextcloud:
|
||||||
|
certs:
|
||||||
|
vhost.d:
|
||||||
|
html:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy-tier:
|
|
@ -0,0 +1,3 @@
|
||||||
|
FROM jwilder/nginx-proxy:alpine
|
||||||
|
|
||||||
|
COPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf
|
|
@ -0,0 +1 @@
|
||||||
|
client_max_body_size 10G;
|
|
@ -0,0 +1,3 @@
|
||||||
|
FROM nginx
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
@ -0,0 +1,162 @@
|
||||||
|
user www-data;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
set_real_ip_from 10.0.0.0/8;
|
||||||
|
set_real_ip_from 172.16.0.0/12;
|
||||||
|
set_real_ip_from 192.168.0.0/16;
|
||||||
|
real_ip_header X-Real-IP;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
upstream php-handler {
|
||||||
|
server app:9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
# Add headers to serve security related headers
|
||||||
|
# Before enabling Strict-Transport-Security headers please read into this
|
||||||
|
# topic first.
|
||||||
|
# add_header Strict-Transport-Security "max-age=15768000;
|
||||||
|
# includeSubDomains; preload;";
|
||||||
|
#
|
||||||
|
# WARNING: Only add the preload option once you read about
|
||||||
|
# the consequences in https://hstspreload.org/. This option
|
||||||
|
# will add the domain to a hardcoded list that is shipped
|
||||||
|
# in all major browsers and getting removed from this list
|
||||||
|
# could take several months.
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
|
add_header X-Download-Options noopen;
|
||||||
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
location = /robots.txt {
|
||||||
|
allow all;
|
||||||
|
log_not_found off;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following 2 rules are only needed for the user_webfinger app.
|
||||||
|
# Uncomment it if you're planning to use this app.
|
||||||
|
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
|
||||||
|
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
|
||||||
|
# last;
|
||||||
|
|
||||||
|
location = /.well-known/carddav {
|
||||||
|
return 301 $scheme://$host/remote.php/dav;
|
||||||
|
}
|
||||||
|
location = /.well-known/caldav {
|
||||||
|
return 301 $scheme://$host/remote.php/dav;
|
||||||
|
}
|
||||||
|
|
||||||
|
# set max upload size
|
||||||
|
client_max_body_size 10G;
|
||||||
|
fastcgi_buffers 64 4K;
|
||||||
|
|
||||||
|
# Enable gzip but do not remove ETag headers
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_comp_level 4;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||||
|
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||||
|
|
||||||
|
# Uncomment if your server is build with the ngx_pagespeed module
|
||||||
|
# This module is currently not supported.
|
||||||
|
#pagespeed off;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
rewrite ^ /index.php$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
# fastcgi_param HTTPS on;
|
||||||
|
#Avoid sending the security headers twice
|
||||||
|
fastcgi_param modHeadersAvailable true;
|
||||||
|
fastcgi_param front_controller_active true;
|
||||||
|
fastcgi_pass php-handler;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
fastcgi_request_buffering off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
|
||||||
|
try_files $uri/ =404;
|
||||||
|
index index.php;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Adding the cache control header for js and css files
|
||||||
|
# Make sure it is BELOW the PHP block
|
||||||
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
|
try_files $uri /index.php$request_uri;
|
||||||
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
|
# Add headers to serve security related headers (It is intended to
|
||||||
|
# have those duplicated to the ones above)
|
||||||
|
# Before enabling Strict-Transport-Security headers please read into
|
||||||
|
# this topic first.
|
||||||
|
# add_header Strict-Transport-Security "max-age=15768000;
|
||||||
|
# includeSubDomains; preload;";
|
||||||
|
#
|
||||||
|
# WARNING: Only add the preload option once you read about
|
||||||
|
# the consequences in https://hstspreload.org/. This option
|
||||||
|
# will add the domain to a hardcoded list that is shipped
|
||||||
|
# in all major browsers and getting removed from this list
|
||||||
|
# could take several months.
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
|
add_header X-Download-Options noopen;
|
||||||
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
|
# Optional: Don't log access to assets
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
|
try_files $uri /index.php$request_uri;
|
||||||
|
# Optional: Don't log access to other assets
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -15,7 +16,7 @@ services:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
app:
|
app:
|
||||||
build: ./app
|
build: ./app
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -15,7 +16,7 @@ services:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
app:
|
app:
|
||||||
build: ./app
|
build: ./app
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -55,6 +55,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -126,7 +127,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -145,12 +146,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -11,7 +12,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:apache
|
image: nextcloud:apache
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mariadb
|
|
||||||
#FROM mysql
|
|
||||||
|
|
||||||
COPY transaction-isolation.conf /etc/mysql/conf.d/transaction-isolation.conf
|
|
|
@ -1,5 +0,0 @@
|
||||||
[mysqld]
|
|
||||||
# Set Transaction isolation Level to READ-COMMITED (Required by nextcloud)
|
|
||||||
# ================================================
|
|
||||||
# https://docs.nextcloud.com/server/13/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level
|
|
||||||
transaction-isolation = READ-COMMITTED
|
|
|
@ -2,7 +2,8 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
build: ./db
|
image: mariadb
|
||||||
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- db:/var/lib/mysql
|
||||||
|
@ -11,7 +12,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:fpm
|
image: nextcloud:fpm
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -55,6 +55,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -126,7 +127,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -145,12 +146,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:apache
|
image: nextcloud:apache
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -9,7 +9,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:fpm
|
image: nextcloud:fpm
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -55,6 +55,7 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ http {
|
||||||
#pagespeed off;
|
#pagespeed off;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
rewrite ^ /index.php$uri;
|
rewrite ^ /index.php$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
@ -126,7 +127,7 @@ http {
|
||||||
# Adding the cache control header for js and css files
|
# Adding the cache control header for js and css files
|
||||||
# Make sure it is BELOW the PHP block
|
# Make sure it is BELOW the PHP block
|
||||||
location ~ \.(?:css|js|woff|svg|gif)$ {
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
add_header Cache-Control "public, max-age=15778463";
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
# Add headers to serve security related headers (It is intended to
|
# Add headers to serve security related headers (It is intended to
|
||||||
# have those duplicated to the ones above)
|
# have those duplicated to the ones above)
|
||||||
|
@ -145,12 +146,14 @@ http {
|
||||||
add_header X-Robots-Tag none;
|
add_header X-Robots-Tag none;
|
||||||
add_header X-Download-Options noopen;
|
add_header X-Download-Options noopen;
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
add_header Referrer-Policy no-referrer;
|
||||||
|
|
||||||
# Optional: Don't log access to assets
|
# Optional: Don't log access to assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
try_files $uri /index.php$uri$is_args$args;
|
try_files $uri /index.php$request_uri;
|
||||||
# Optional: Don't log access to other assets
|
# Optional: Don't log access to other assets
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,6 @@ RUN apt-get update && apt-get install -y \
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
|
||||||
|
ENV NEXTCLOUD_UPDATE=1
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
|
|
@ -7,4 +7,6 @@ RUN apt-get update && apt-get install -y \
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
|
||||||
|
ENV NEXTCLOUD_UPDATE=1
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM nextcloud:apache
|
FROM nextcloud:apache
|
||||||
|
|
||||||
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \
|
RUN mkdir -p /usr/share/man/man1 \
|
||||||
&& apt-get update && apt-get install -y \
|
&& apt-get update && apt-get install -y \
|
||||||
supervisor \
|
supervisor \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
@ -11,7 +11,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
|
||||||
libkrb5-dev \
|
libkrb5-dev \
|
||||||
smbclient \
|
smbclient \
|
||||||
libsmbclient-dev \
|
libsmbclient-dev \
|
||||||
# LibreOffice \
|
# libreoffice \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||||
&& ln -s "/usr/include/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)/gmp.h" /usr/include/gmp.h \
|
&& ln -s "/usr/include/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)/gmp.h" /usr/include/gmp.h \
|
||||||
|
@ -30,4 +30,6 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
|
||||||
|
ENV NEXTCLOUD_UPDATE=1
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM nextcloud:fpm
|
FROM nextcloud:fpm
|
||||||
|
|
||||||
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \
|
RUN mkdir -p /usr/share/man/man1 \
|
||||||
&& apt-get update && apt-get install -y \
|
&& apt-get update && apt-get install -y \
|
||||||
supervisor \
|
supervisor \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
@ -10,7 +10,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
|
||||||
libkrb5-dev \
|
libkrb5-dev \
|
||||||
smbclient \
|
smbclient \
|
||||||
libsmbclient-dev \
|
libsmbclient-dev \
|
||||||
# LibreOffice \
|
# libreoffice \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||||
&& ln -s "/usr/include/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)/gmp.h" /usr/include/gmp.h \
|
&& ln -s "/usr/include/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)/gmp.h" /usr/include/gmp.h \
|
||||||
|
@ -21,4 +21,6 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
|
||||||
|
ENV NEXTCLOUD_UPDATE=1
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
|
43
.travis.yml
43
.travis.yml
|
@ -1,9 +1,5 @@
|
||||||
dist: trusty
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
services: docker
|
|
||||||
|
|
||||||
language: bash
|
language: bash
|
||||||
|
services: docker
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
@ -14,13 +10,19 @@ install:
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- env | sort
|
- env | sort
|
||||||
|
- wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash
|
||||||
- image="nextcloud:${VERSION}${VARIANT:+-$VARIANT}"
|
- image="nextcloud:${VERSION}${VARIANT:+-$VARIANT}"
|
||||||
- if [[ "$ARCH" == 'i386' ]]; then sed -i -e 's/FROM php/FROM i386\/php/g' "${VERSION}/${VARIANT}/Dockerfile"; fi
|
- if [[ "$ARCH" == 'i386' ]]; then sed -i -e 's/FROM php/FROM i386\/php/g' "${VERSION}/${VARIANT}/Dockerfile"; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- travis_retry docker build -t "$image" "${VERSION}/${VARIANT}"
|
- |
|
||||||
- ~/official-images/test/run.sh "$image"
|
(
|
||||||
- .travis/test-example-dockerfiles.sh "$image"
|
set -Eeuo pipefail
|
||||||
|
set -x
|
||||||
|
docker build -t "$image" "${VERSION}/${VARIANT}"
|
||||||
|
~/official-images/test/run.sh "$image"
|
||||||
|
.travis/test-example-dockerfiles.sh "$image"
|
||||||
|
)
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- docker images
|
- docker images
|
||||||
|
@ -30,7 +32,6 @@ jobs:
|
||||||
- &test-scripts
|
- &test-scripts
|
||||||
stage: test scripts
|
stage: test scripts
|
||||||
env: SCRIPT=update.sh
|
env: SCRIPT=update.sh
|
||||||
sudo: false
|
|
||||||
services: []
|
services: []
|
||||||
install: skip
|
install: skip
|
||||||
before_script: skip
|
before_script: skip
|
||||||
|
@ -49,18 +50,12 @@ jobs:
|
||||||
- ./generate-stackbrew-library.sh
|
- ./generate-stackbrew-library.sh
|
||||||
|
|
||||||
- stage: test images
|
- stage: test images
|
||||||
env: VERSION=12.0-rc VARIANT=fpm-alpine ARCH=amd64
|
env: VERSION=15.0-beta VARIANT=fpm-alpine ARCH=amd64
|
||||||
- env: VERSION=12.0-rc VARIANT=fpm-alpine ARCH=i386
|
- env: VERSION=15.0-beta VARIANT=fpm-alpine ARCH=i386
|
||||||
- env: VERSION=12.0-rc VARIANT=fpm ARCH=amd64
|
- env: VERSION=15.0-beta VARIANT=fpm ARCH=amd64
|
||||||
- env: VERSION=12.0-rc VARIANT=fpm ARCH=i386
|
- env: VERSION=15.0-beta VARIANT=fpm ARCH=i386
|
||||||
- env: VERSION=12.0-rc VARIANT=apache ARCH=amd64
|
- env: VERSION=15.0-beta VARIANT=apache ARCH=amd64
|
||||||
- env: VERSION=12.0-rc VARIANT=apache ARCH=i386
|
- env: VERSION=15.0-beta VARIANT=apache ARCH=i386
|
||||||
- env: VERSION=13.0-rc VARIANT=fpm-alpine ARCH=amd64
|
|
||||||
- env: VERSION=13.0-rc VARIANT=fpm-alpine ARCH=i386
|
|
||||||
- env: VERSION=13.0-rc VARIANT=fpm ARCH=amd64
|
|
||||||
- env: VERSION=13.0-rc VARIANT=fpm ARCH=i386
|
|
||||||
- env: VERSION=13.0-rc VARIANT=apache ARCH=amd64
|
|
||||||
- env: VERSION=13.0-rc VARIANT=apache ARCH=i386
|
|
||||||
- env: VERSION=12.0 VARIANT=fpm-alpine ARCH=amd64
|
- env: VERSION=12.0 VARIANT=fpm-alpine ARCH=amd64
|
||||||
- env: VERSION=12.0 VARIANT=fpm-alpine ARCH=i386
|
- env: VERSION=12.0 VARIANT=fpm-alpine ARCH=i386
|
||||||
- env: VERSION=12.0 VARIANT=fpm ARCH=amd64
|
- env: VERSION=12.0 VARIANT=fpm ARCH=amd64
|
||||||
|
@ -73,3 +68,9 @@ jobs:
|
||||||
- env: VERSION=13.0 VARIANT=fpm ARCH=i386
|
- env: VERSION=13.0 VARIANT=fpm ARCH=i386
|
||||||
- env: VERSION=13.0 VARIANT=apache ARCH=amd64
|
- env: VERSION=13.0 VARIANT=apache ARCH=amd64
|
||||||
- env: VERSION=13.0 VARIANT=apache ARCH=i386
|
- env: VERSION=13.0 VARIANT=apache ARCH=i386
|
||||||
|
- env: VERSION=14.0 VARIANT=fpm-alpine ARCH=amd64
|
||||||
|
- env: VERSION=14.0 VARIANT=fpm-alpine ARCH=i386
|
||||||
|
- env: VERSION=14.0 VARIANT=fpm ARCH=amd64
|
||||||
|
- env: VERSION=14.0 VARIANT=fpm ARCH=i386
|
||||||
|
- env: VERSION=14.0 VARIANT=apache ARCH=amd64
|
||||||
|
- env: VERSION=14.0 VARIANT=apache ARCH=i386
|
||||||
|
|
|
@ -10,10 +10,9 @@ dirs=( "${dirs[@]%/}" )
|
||||||
for dir in "${dirs[@]}"; do
|
for dir in "${dirs[@]}"; do
|
||||||
if [ -d "$dir/$VARIANT" ]; then
|
if [ -d "$dir/$VARIANT" ]; then
|
||||||
(
|
(
|
||||||
cd "$dir/$VARIANT"
|
cd "$dir/$VARIANT"
|
||||||
sed -ri -e 's/^FROM .*/FROM '"$image"'/g' 'Dockerfile'
|
sed -ri -e 's/^FROM .*/FROM '"$image"'/g' 'Dockerfile'
|
||||||
docker build -t "$image-$dir" .
|
docker build -t "$image-$dir" .
|
||||||
~/official-images/test/run.sh "$image-$dir"
|
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-apache
|
FROM php:7.1-apache-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -105,9 +106,16 @@ RUN a2enmod rewrite remoteip ;\
|
||||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||||
a2enconf remoteip
|
a2enconf remoteip
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 12.0.6
|
ENV NEXTCLOUD_VERSION 12.0.12
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
|
@ -116,15 +124,18 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
12.0/apache/upgrade.exclude
Normal file
4
12.0/apache/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
||||||
FROM php:7.1-fpm-alpine
|
FROM php:7.1-fpm-alpine3.8
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -16,7 +16,7 @@ RUN set -ex; \
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache --virtual .build-deps \
|
apk add --no-cache --virtual .build-deps \
|
||||||
alpine-sdk \
|
$PHPIZE_DEPS \
|
||||||
autoconf \
|
autoconf \
|
||||||
freetype-dev \
|
freetype-dev \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
|
@ -37,21 +37,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -79,6 +76,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -86,7 +87,7 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 12.0.6
|
ENV NEXTCLOUD_VERSION 12.0.12
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache --virtual .fetch-deps \
|
apk add --no-cache --virtual .fetch-deps \
|
||||||
|
@ -102,16 +103,16 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ; \
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
apk del .fetch-deps
|
apk del .fetch-deps
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
12.0/fpm-alpine/upgrade.exclude
Normal file
4
12.0/fpm-alpine/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-fpm
|
FROM php:7.1-fpm-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -97,9 +98,16 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 12.0.6
|
ENV NEXTCLOUD_VERSION 12.0.12
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
|
@ -108,15 +116,18 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
12.0/fpm/upgrade.exclude
Normal file
4
12.0/fpm/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$autoconfig_enabled = false;
|
|
||||||
|
|
||||||
if (getenv('SQLITE_DATABASE')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "sqlite";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('SQLITE_DATABASE');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "mysql";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('MYSQL_DATABASE');
|
|
||||||
$AUTOCONFIG["dbuser"] = getenv('MYSQL_USER');
|
|
||||||
$AUTOCONFIG["dbpass"] = getenv('MYSQL_PASSWORD');
|
|
||||||
$AUTOCONFIG["dbhost"] = getenv('MYSQL_HOST');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "pgsql";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('POSTGRES_DB');
|
|
||||||
$AUTOCONFIG["dbuser"] = getenv('POSTGRES_USER');
|
|
||||||
$AUTOCONFIG["dbpass"] = getenv('POSTGRES_PASSWORD');
|
|
||||||
$AUTOCONFIG["dbhost"] = getenv('POSTGRES_HOST');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($autoconfig_enabled) {
|
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$autoconfig_enabled = false;
|
|
||||||
|
|
||||||
if (getenv('SQLITE_DATABASE')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "sqlite";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('SQLITE_DATABASE');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "mysql";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('MYSQL_DATABASE');
|
|
||||||
$AUTOCONFIG["dbuser"] = getenv('MYSQL_USER');
|
|
||||||
$AUTOCONFIG["dbpass"] = getenv('MYSQL_PASSWORD');
|
|
||||||
$AUTOCONFIG["dbhost"] = getenv('MYSQL_HOST');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {
|
|
||||||
$AUTOCONFIG["dbtype"] = "pgsql";
|
|
||||||
$AUTOCONFIG["dbname"] = getenv('POSTGRES_DB');
|
|
||||||
$AUTOCONFIG["dbuser"] = getenv('POSTGRES_USER');
|
|
||||||
$AUTOCONFIG["dbpass"] = getenv('POSTGRES_PASSWORD');
|
|
||||||
$AUTOCONFIG["dbhost"] = getenv('POSTGRES_HOST');
|
|
||||||
$autoconfig_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($autoconfig_enabled) {
|
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
|
||||||
version_greater() {
|
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# return true if specified directory is empty
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
run_as() {
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
su - www-data -s /bin/sh -c "$1"
|
|
||||||
else
|
|
||||||
sh -c "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
|
||||||
if [ -f /var/www/html/version.php ]; then
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
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.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
|
||||||
echo "The following apps have beed disabled:"
|
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-apache
|
FROM php:7.2-apache-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -105,9 +106,16 @@ RUN a2enmod rewrite remoteip ;\
|
||||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||||
a2enconf remoteip
|
a2enconf remoteip
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 13.0.1
|
ENV NEXTCLOUD_VERSION 13.0.7
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
|
@ -116,15 +124,18 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
13.0/apache/upgrade.exclude
Normal file
4
13.0/apache/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
||||||
FROM php:7.1-fpm-alpine
|
FROM php:7.2-fpm-alpine3.8
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -16,7 +16,7 @@ RUN set -ex; \
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache --virtual .build-deps \
|
apk add --no-cache --virtual .build-deps \
|
||||||
alpine-sdk \
|
$PHPIZE_DEPS \
|
||||||
autoconf \
|
autoconf \
|
||||||
freetype-dev \
|
freetype-dev \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
|
@ -37,21 +37,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -79,6 +76,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -86,7 +87,7 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 13.0.1
|
ENV NEXTCLOUD_VERSION 13.0.7
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache --virtual .fetch-deps \
|
apk add --no-cache --virtual .fetch-deps \
|
||||||
|
@ -102,16 +103,16 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ; \
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
apk del .fetch-deps
|
apk del .fetch-deps
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
13.0/fpm-alpine/upgrade.exclude
Normal file
4
13.0/fpm-alpine/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-fpm
|
FROM php:7.2-fpm-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -97,9 +98,16 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 13.0.1
|
ENV NEXTCLOUD_VERSION 13.0.7
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
|
@ -108,15 +116,18 @@ RUN set -ex; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
|
|
||||||
# version_greater A B returns whether A > B
|
# version_greater A B returns whether A > B
|
||||||
version_greater() {
|
version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
|
@ -12,50 +12,120 @@ directory_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_as() {
|
run_as() {
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
su - www-data -s /bin/sh -c "$1"
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
else
|
else
|
||||||
sh -c "$1"
|
sh -c "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
if [ -f /var/www/html/version.php ]; then
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
|
||||||
|
|
||||||
if version_greater "$installed_version" "$image_version"; then
|
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?"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" = 0 ]; then
|
|
||||||
rsync_options="-rlDog --chown www-data:root"
|
|
||||||
else
|
|
||||||
rsync_options="-rlD"
|
|
||||||
fi
|
|
||||||
rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/
|
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
echo "Initializing nextcloud $image_version ..."
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
fi
|
fi
|
||||||
done
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
for dir in config data custom_apps themes; do
|
||||||
run_as 'php /var/www/html/occ upgrade --no-app-disable'
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
#install
|
||||||
echo "The following apps have beed disabled:"
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
echo "New nextcloud instance"
|
||||||
rm -f /tmp/list_before /tmp/list_after
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
13.0/fpm/upgrade.exclude
Normal file
4
13.0/fpm/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-apache
|
FROM php:7.2-apache-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -105,26 +106,36 @@ RUN a2enmod rewrite remoteip ;\
|
||||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||||
a2enconf remoteip
|
a2enconf remoteip
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 13.0.2RC1
|
ENV NEXTCLOUD_VERSION 14.0.3
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
||||||
export GNUPGHOME="$(mktemp -d)"; \
|
export GNUPGHOME="$(mktemp -d)"; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
132
14.0/apache/entrypoint.sh
Executable file
132
14.0/apache/entrypoint.sh
Executable file
|
@ -0,0 +1,132 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# version_greater A B returns whether A > B
|
||||||
|
version_greater() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# return true if specified directory is empty
|
||||||
|
directory_empty() {
|
||||||
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
run_as() {
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
|
else
|
||||||
|
sh -c "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
|
||||||
|
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
|
||||||
|
echo "Initializing nextcloud $image_version ..."
|
||||||
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
|
fi
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
|
#install
|
||||||
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
|
echo "New nextcloud instance"
|
||||||
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
4
14.0/apache/upgrade.exclude
Normal file
4
14.0/apache/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
||||||
FROM php:7.1-fpm-alpine
|
FROM php:7.2-fpm-alpine3.8
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -16,7 +16,7 @@ RUN set -ex; \
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache --virtual .build-deps \
|
apk add --no-cache --virtual .build-deps \
|
||||||
alpine-sdk \
|
$PHPIZE_DEPS \
|
||||||
autoconf \
|
autoconf \
|
||||||
freetype-dev \
|
freetype-dev \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
|
@ -37,21 +37,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -79,6 +76,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -86,7 +87,7 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 12.0.7RC1
|
ENV NEXTCLOUD_VERSION 14.0.3
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache --virtual .fetch-deps \
|
apk add --no-cache --virtual .fetch-deps \
|
||||||
|
@ -95,23 +96,23 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
||||||
export GNUPGHOME="$(mktemp -d)"; \
|
export GNUPGHOME="$(mktemp -d)"; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ; \
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
apk del .fetch-deps
|
apk del .fetch-deps
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
132
14.0/fpm-alpine/entrypoint.sh
Executable file
132
14.0/fpm-alpine/entrypoint.sh
Executable file
|
@ -0,0 +1,132 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# version_greater A B returns whether A > B
|
||||||
|
version_greater() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# return true if specified directory is empty
|
||||||
|
directory_empty() {
|
||||||
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
run_as() {
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
su -p www-data -s /bin/sh -c "$1"
|
||||||
|
else
|
||||||
|
sh -c "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
|
installed_version="0.0.0.0"
|
||||||
|
if [ -f /var/www/html/version.php ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
fi
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||||
|
|
||||||
|
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
|
||||||
|
echo "Initializing nextcloud $image_version ..."
|
||||||
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
echo "Upgrading nextcloud from $installed_version ..."
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||||
|
fi
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
|
||||||
|
#install
|
||||||
|
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||||
|
echo "New nextcloud instance"
|
||||||
|
|
||||||
|
if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"'
|
||||||
|
if [ -n "${NEXTCLOUD_TABLE_PREFIX+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-table-prefix "$NEXTCLOUD_TABLE_PREFIX"'
|
||||||
|
else
|
||||||
|
install_options=$install_options' --database-table-prefix ""'
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install=false
|
||||||
|
if [ -n "${SQLITE_DATABASE+x}" ]; then
|
||||||
|
echo "Installing with SQLite database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database-name "$SQLITE_DATABASE"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_USER+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ]; then
|
||||||
|
echo "Installing with MySQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
|
||||||
|
install=true
|
||||||
|
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
|
||||||
|
echo "Installing with PostgreSQL database"
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
|
||||||
|
install=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install" = true ]; then
|
||||||
|
echo "starting nexcloud installation"
|
||||||
|
max_retries=10
|
||||||
|
try=0
|
||||||
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
do
|
||||||
|
echo "retrying install..."
|
||||||
|
try=$((try+1))
|
||||||
|
sleep 3s
|
||||||
|
done
|
||||||
|
if [ "$try" -gt "$max_retries" ]; then
|
||||||
|
echo "installing of nextcloud failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||||
|
echo "setting trusted domains…"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=1
|
||||||
|
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||||
|
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
|
||||||
|
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "running web-based installer on first connect!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#upgrade
|
||||||
|
else
|
||||||
|
run_as 'php /var/www/html/occ upgrade'
|
||||||
|
|
||||||
|
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||||
|
echo "The following apps have been disabled:"
|
||||||
|
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||||
|
rm -f /tmp/list_before /tmp/list_after
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
4
14.0/fpm-alpine/upgrade.exclude
Normal file
4
14.0/fpm-alpine/upgrade.exclude
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/config/
|
||||||
|
/data/
|
||||||
|
/custom_apps/
|
||||||
|
/themes/
|
|
@ -1,5 +1,5 @@
|
||||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||||
FROM php:7.1-fpm
|
FROM php:7.2-fpm-stretch
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
# entrypoint.sh and cron.sh dependencies
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
@ -30,7 +30,7 @@ RUN set -ex; \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libmemcached-dev \
|
libmemcached-dev \
|
||||||
libpng12-dev \
|
libpng-dev \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
; \
|
; \
|
||||||
|
@ -43,21 +43,18 @@ RUN set -ex; \
|
||||||
gd \
|
gd \
|
||||||
intl \
|
intl \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring \
|
|
||||||
mcrypt \
|
|
||||||
mysqli \
|
|
||||||
opcache \
|
opcache \
|
||||||
pcntl \
|
pcntl \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
pdo_pgsql \
|
pdo_pgsql \
|
||||||
pgsql \
|
|
||||||
zip \
|
zip \
|
||||||
; \
|
; \
|
||||||
pecl install \
|
\
|
||||||
APCu-5.1.11 \
|
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||||
memcached-3.0.4 \
|
pecl install APCu-5.1.12; \
|
||||||
redis-3.1.6 \
|
pecl install memcached-3.0.4; \
|
||||||
; \
|
pecl install redis-4.1.1; \
|
||||||
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
memcached \
|
||||||
|
@ -90,6 +87,10 @@ RUN { \
|
||||||
echo 'opcache.revalidate_freq=1'; \
|
echo 'opcache.revalidate_freq=1'; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||||
\
|
\
|
||||||
|
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||||
|
\
|
||||||
|
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \
|
||||||
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data; \
|
||||||
chown -R www-data:root /var/www; \
|
chown -R www-data:root /var/www; \
|
||||||
chmod -R g=u /var/www
|
chmod -R g=u /var/www
|
||||||
|
@ -97,26 +98,36 @@ RUN { \
|
||||||
VOLUME /var/www/html
|
VOLUME /var/www/html
|
||||||
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_VERSION 13.0.2RC1
|
ENV NEXTCLOUD_VERSION 14.0.3
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
|
fetchDeps=" \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
|
"; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||||
|
\
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
"https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
||||||
export GNUPGHOME="$(mktemp -d)"; \
|
export GNUPGHOME="$(mktemp -d)"; \
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
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; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||||
rm nextcloud.tar.bz2; \
|
gpgconf --kill all; \
|
||||||
|
rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
rm -rf /usr/src/nextcloud/updater; \
|
rm -rf /usr/src/nextcloud/updater; \
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
mkdir -p /usr/src/nextcloud/data; \
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||||
chmod +x /usr/src/nextcloud/occ
|
chmod +x /usr/src/nextcloud/occ; \
|
||||||
|
\
|
||||||
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY *.sh /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -26,9 +26,4 @@ if ($autoconfig_enabled) {
|
||||||
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
$AUTOCONFIG["dbtableprefix"] = getenv('NEXTCLOUD_TABLE_PREFIX') ?: "";
|
||||||
|
|
||||||
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
|
||||||
|
|
||||||
if (getenv('NEXTCLOUD_ADMIN_USER') && getenv('NEXTCLOUD_ADMIN_PASSWORD')) {
|
|
||||||
$AUTOCONFIG["adminlogin"] = getenv('NEXTCLOUD_ADMIN_USER');
|
|
||||||
$AUTOCONFIG["adminpass"] = getenv('NEXTCLOUD_ADMIN_PASSWORD');
|
|
||||||
}
|
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue