Skip to content

Commit 1f87830

Browse files
author
GitHub Workflow
committed
Runs update.sh
1 parent f5b7b40 commit 1f87830

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2163
-1
lines changed

32/apache/Dockerfile

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
2+
FROM php:8.3-apache-trixie
3+
4+
# entrypoint.sh and cron.sh dependencies
5+
RUN set -ex; \
6+
\
7+
apt-get update; \
8+
apt-get install -y --no-install-recommends \
9+
busybox-static \
10+
bzip2 \
11+
libldap-common \
12+
libmagickcore-7.q16-10-extra \
13+
rsync \
14+
; \
15+
apt-get dist-clean; \
16+
\
17+
mkdir -p /var/spool/cron/crontabs; \
18+
echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data
19+
20+
# install the PHP extensions we need
21+
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
22+
ENV PHP_MEMORY_LIMIT 512M
23+
ENV PHP_UPLOAD_LIMIT 512M
24+
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
25+
RUN set -ex; \
26+
\
27+
savedAptMark="$(apt-mark showmanual)"; \
28+
\
29+
apt-get update; \
30+
apt-get install -y --no-install-recommends \
31+
libcurl4-openssl-dev \
32+
libevent-dev \
33+
libfreetype6-dev \
34+
libgmp-dev \
35+
libicu-dev \
36+
libjpeg-dev \
37+
libldap2-dev \
38+
libmagickwand-dev \
39+
libmemcached-dev \
40+
libpng-dev \
41+
libpq-dev \
42+
libwebp-dev \
43+
libxml2-dev \
44+
libzip-dev \
45+
; \
46+
\
47+
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
48+
docker-php-ext-configure ftp --with-openssl-dir=/usr; \
49+
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
50+
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
51+
docker-php-ext-install -j "$(nproc)" \
52+
bcmath \
53+
exif \
54+
ftp \
55+
gd \
56+
gmp \
57+
intl \
58+
ldap \
59+
pcntl \
60+
pdo_mysql \
61+
pdo_pgsql \
62+
sysvsem \
63+
zip \
64+
; \
65+
\
66+
# pecl will claim success even if one install fails, so we need to perform each install separately
67+
pecl install APCu-5.1.27; \
68+
pecl install igbinary-3.2.16; \
69+
pecl install imagick-3.8.0; \
70+
pecl install memcached-3.3.0 \
71+
--configureoptions 'enable-memcached-igbinary="yes"'; \
72+
pecl install redis-6.2.0 \
73+
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
74+
\
75+
docker-php-ext-enable \
76+
apcu \
77+
igbinary \
78+
imagick \
79+
memcached \
80+
redis \
81+
; \
82+
rm -r /tmp/pear; \
83+
\
84+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
85+
apt-mark auto '.*' > /dev/null; \
86+
apt-mark manual $savedAptMark; \
87+
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
88+
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
89+
| sort -u \
90+
| xargs -rt dpkg-query --search \
91+
# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)
92+
| awk 'sub(":$", "", $1) { print $1 }' \
93+
| sort -u \
94+
| xargs -rt apt-mark manual; \
95+
\
96+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
97+
apt-get dist-clean
98+
99+
# set recommended PHP.ini settings
100+
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
101+
RUN { \
102+
echo 'opcache.enable=1'; \
103+
echo 'opcache.interned_strings_buffer=32'; \
104+
echo 'opcache.max_accelerated_files=10000'; \
105+
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \
106+
echo 'opcache.save_comments=1'; \
107+
echo 'opcache.revalidate_freq=60'; \
108+
echo 'opcache.jit=1255'; \
109+
echo 'opcache.jit_buffer_size=8M'; \
110+
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
111+
\
112+
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
113+
\
114+
{ \
115+
echo 'apc.serializer=igbinary'; \
116+
echo 'session.serialize_handler=igbinary'; \
117+
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
118+
\
119+
{ \
120+
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
121+
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
122+
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
123+
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
124+
\
125+
mkdir /var/www/data; \
126+
mkdir -p /docker-entrypoint-hooks.d/pre-installation \
127+
/docker-entrypoint-hooks.d/post-installation \
128+
/docker-entrypoint-hooks.d/pre-upgrade \
129+
/docker-entrypoint-hooks.d/post-upgrade \
130+
/docker-entrypoint-hooks.d/before-starting; \
131+
chown -R www-data:root /var/www; \
132+
chmod -R g=u /var/www
133+
134+
VOLUME /var/www/html
135+
136+
RUN a2enmod headers rewrite remoteip ; \
137+
{ \
138+
echo 'RemoteIPHeader X-Real-IP'; \
139+
echo 'RemoteIPInternalProxy 10.0.0.0/8'; \
140+
echo 'RemoteIPInternalProxy 172.16.0.0/12'; \
141+
echo 'RemoteIPInternalProxy 192.168.0.0/16'; \
142+
} > /etc/apache2/conf-available/remoteip.conf; \
143+
a2enconf remoteip
144+
145+
# set apache config LimitRequestBody
146+
ENV APACHE_BODY_LIMIT 1073741824
147+
RUN { \
148+
echo 'LimitRequestBody ${APACHE_BODY_LIMIT}'; \
149+
} > /etc/apache2/conf-available/apache-limits.conf; \
150+
a2enconf apache-limits
151+
152+
ENV NEXTCLOUD_VERSION 32.0.0
153+
154+
RUN set -ex; \
155+
fetchDeps=" \
156+
gnupg \
157+
dirmngr \
158+
"; \
159+
apt-get update; \
160+
apt-get install -y --no-install-recommends $fetchDeps; \
161+
\
162+
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-32.0.0.tar.bz2"; \
163+
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-32.0.0.tar.bz2.asc"; \
164+
export GNUPGHOME="$(mktemp -d)"; \
165+
# gpg key from https://nextcloud.com/nextcloud.asc
166+
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
167+
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
168+
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
169+
gpgconf --kill all; \
170+
rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
171+
rm -rf "$GNUPGHOME" /usr/src/nextcloud/updater; \
172+
mkdir -p /usr/src/nextcloud/data; \
173+
mkdir -p /usr/src/nextcloud/custom_apps; \
174+
chmod +x /usr/src/nextcloud/occ; \
175+
\
176+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
177+
apt-get dist-clean
178+
179+
COPY *.sh upgrade.exclude /
180+
COPY config/* /usr/src/nextcloud/config/
181+
182+
ENTRYPOINT ["/entrypoint.sh"]
183+
CMD ["apache2-foreground"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$CONFIG = array (
3+
'htaccess.RewriteBase' => '/',
4+
);

32/apache/config/apcu.config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$CONFIG = array (
3+
'memcache.local' => '\OC\Memcache\APCu',
4+
);

32/apache/config/apps.config.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$CONFIG = array (
3+
'apps_paths' => array (
4+
0 => array (
5+
'path' => OC::$SERVERROOT.'/apps',
6+
'url' => '/apps',
7+
'writable' => false,
8+
),
9+
1 => array (
10+
'path' => OC::$SERVERROOT.'/custom_apps',
11+
'url' => '/custom_apps',
12+
'writable' => true,
13+
),
14+
),
15+
);

32/apache/config/autoconfig.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$autoconfig_enabled = false;
4+
5+
if (getenv('SQLITE_DATABASE')) {
6+
$AUTOCONFIG['dbtype'] = 'sqlite';
7+
$AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');
8+
$autoconfig_enabled = true;
9+
} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {
10+
$AUTOCONFIG['dbtype'] = 'mysql';
11+
$AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));
12+
$AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));
13+
$AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));
14+
$AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');
15+
$autoconfig_enabled = true;
16+
} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {
17+
$AUTOCONFIG['dbtype'] = 'mysql';
18+
$AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');
19+
$AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');
20+
$AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');
21+
$AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');
22+
$autoconfig_enabled = true;
23+
} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {
24+
$AUTOCONFIG['dbtype'] = 'pgsql';
25+
$AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));
26+
$AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));
27+
$AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));
28+
$AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');
29+
$autoconfig_enabled = true;
30+
} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {
31+
$AUTOCONFIG['dbtype'] = 'pgsql';
32+
$AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');
33+
$AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');
34+
$AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');
35+
$AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');
36+
$autoconfig_enabled = true;
37+
}
38+
39+
if ($autoconfig_enabled) {
40+
$AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';
41+
}

32/apache/config/redis.config.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
if (getenv('REDIS_HOST')) {
3+
$CONFIG = array(
4+
'memcache.distributed' => '\OC\Memcache\Redis',
5+
'memcache.locking' => '\OC\Memcache\Redis',
6+
'redis' => array(
7+
'host' => getenv('REDIS_HOST'),
8+
'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),
9+
),
10+
);
11+
12+
if (getenv('REDIS_HOST_PORT') !== false) {
13+
$CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
14+
} elseif (getenv('REDIS_HOST')[0] != '/') {
15+
$CONFIG['redis']['port'] = 6379;
16+
}
17+
18+
if (getenv('REDIS_HOST_USER') !== false) {
19+
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
20+
}
21+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
$overwriteHost = getenv('OVERWRITEHOST');
3+
if ($overwriteHost) {
4+
$CONFIG['overwritehost'] = $overwriteHost;
5+
}
6+
7+
$overwriteProtocol = getenv('OVERWRITEPROTOCOL');
8+
if ($overwriteProtocol) {
9+
$CONFIG['overwriteprotocol'] = $overwriteProtocol;
10+
}
11+
12+
$overwriteCliUrl = getenv('OVERWRITECLIURL');
13+
if ($overwriteCliUrl) {
14+
$CONFIG['overwrite.cli.url'] = $overwriteCliUrl;
15+
}
16+
17+
$overwriteWebRoot = getenv('OVERWRITEWEBROOT');
18+
if ($overwriteWebRoot) {
19+
$CONFIG['overwritewebroot'] = $overwriteWebRoot;
20+
}
21+
22+
$overwriteCondAddr = getenv('OVERWRITECONDADDR');
23+
if ($overwriteCondAddr) {
24+
$CONFIG['overwritecondaddr'] = $overwriteCondAddr;
25+
}
26+
27+
$trustedProxies = getenv('TRUSTED_PROXIES');
28+
if ($trustedProxies) {
29+
$CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));
30+
}
31+
32+
$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');
33+
if ($forwardedForHeaders) {
34+
$CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));
35+
}

32/apache/config/s3.config.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
if (getenv('OBJECTSTORE_S3_BUCKET')) {
3+
$use_ssl = getenv('OBJECTSTORE_S3_SSL');
4+
$use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');
5+
$use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');
6+
$autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');
7+
$CONFIG = array(
8+
'objectstore' => array(
9+
'class' => '\OC\Files\ObjectStore\S3',
10+
'arguments' => array(
11+
'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),
12+
'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',
13+
'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',
14+
'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',
15+
'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',
16+
'objectPrefix' => getenv("OBJECTSTORE_S3_OBJECT_PREFIX") ? getenv("OBJECTSTORE_S3_OBJECT_PREFIX") : "urn:oid:",
17+
'autocreate' => strtolower($autocreate) !== 'false',
18+
'use_ssl' => strtolower($use_ssl) !== 'false',
19+
// required for some non Amazon S3 implementations
20+
'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',
21+
// required for older protocol versions
22+
'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'
23+
)
24+
)
25+
);
26+
27+
if (getenv('OBJECTSTORE_S3_KEY_FILE')) {
28+
$CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));
29+
} elseif (getenv('OBJECTSTORE_S3_KEY')) {
30+
$CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');
31+
} else {
32+
$CONFIG['objectstore']['arguments']['key'] = '';
33+
}
34+
35+
if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {
36+
$CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));
37+
} elseif (getenv('OBJECTSTORE_S3_SECRET')) {
38+
$CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');
39+
} else {
40+
$CONFIG['objectstore']['arguments']['secret'] = '';
41+
}
42+
43+
if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {
44+
$CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));
45+
} elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {
46+
$CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');
47+
}
48+
}

32/apache/config/smtp.config.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {
3+
$CONFIG = array (
4+
'mail_smtpmode' => 'smtp',
5+
'mail_smtphost' => getenv('SMTP_HOST'),
6+
'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),
7+
'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',
8+
'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),
9+
'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',
10+
'mail_smtpname' => getenv('SMTP_NAME') ?: '',
11+
'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),
12+
'mail_domain' => getenv('MAIL_DOMAIN'),
13+
);
14+
15+
if (getenv('SMTP_PASSWORD_FILE')) {
16+
$CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));
17+
} elseif (getenv('SMTP_PASSWORD')) {
18+
$CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');
19+
} else {
20+
$CONFIG['mail_smtppassword'] = '';
21+
}
22+
}

0 commit comments

Comments
 (0)