update dockerbuild
Cette révision appartient à :
+92
-104
@@ -1,39 +1,17 @@
|
|||||||
ARG NC_VERS
|
ARG NC_VERS
|
||||||
|
|
||||||
FROM php:8.4-apache-trixie
|
############################
|
||||||
|
# STAGE 1 ? BUILD
|
||||||
|
############################
|
||||||
|
FROM php:8.4-apache-trixie AS build
|
||||||
|
|
||||||
ARG NC_VERS
|
ARG NC_VERS
|
||||||
ENV NEXTCLOUD_VERSION ${NC_VERS}
|
ENV NEXTCLOUD_VERSION=${NC_VERS}
|
||||||
|
|
||||||
|
RUN set -eux; \
|
||||||
# entrypoint.sh and cron.sh dependencies
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
rsync \
|
|
||||||
bzip2 \
|
|
||||||
busybox-static \
|
|
||||||
libldap-common \
|
|
||||||
libmagickcore-7.q16-10-extra \
|
|
||||||
libzip5 \
|
|
||||||
libmemcached11 \
|
|
||||||
; \
|
|
||||||
|
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
|
||||||
\
|
|
||||||
mkdir -p /var/spool/cron/crontabs; \
|
|
||||||
echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data
|
|
||||||
|
|
||||||
# install the PHP extensions we need
|
|
||||||
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
|
|
||||||
ENV PHP_MEMORY_LIMIT 512M
|
|
||||||
ENV PHP_UPLOAD_LIMIT 512M
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
|
||||||
\
|
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
libevent-dev \
|
libevent-dev \
|
||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
@@ -49,15 +27,20 @@ RUN set -ex; \
|
|||||||
libzip-dev \
|
libzip-dev \
|
||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
libgmp-dev \
|
libgmp-dev \
|
||||||
imagemagick \
|
|
||||||
libbz2-dev \
|
libbz2-dev \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
gnupg \
|
||||||
|
dirmngr \
|
||||||
; \
|
; \
|
||||||
\
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN set -eux; \
|
||||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||||
docker-php-ext-configure ftp --with-ftp-ssl; \
|
docker-php-ext-configure ftp --with-ftp-ssl; \
|
||||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
|
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
|
||||||
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
|
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
|
||||||
docker-php-ext-install -j "$(nproc)" \
|
docker-php-ext-install -j"$(nproc)" \
|
||||||
bcmath \
|
bcmath \
|
||||||
exif \
|
exif \
|
||||||
ftp \
|
ftp \
|
||||||
@@ -71,39 +54,90 @@ RUN set -ex; \
|
|||||||
sysvsem \
|
sysvsem \
|
||||||
zip \
|
zip \
|
||||||
gmp \
|
gmp \
|
||||||
bz2 \
|
bz2
|
||||||
; \
|
|
||||||
\
|
RUN set -eux; \
|
||||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
|
||||||
pecl install APCu-5.1.28; \
|
pecl install APCu-5.1.28; \
|
||||||
pecl install igbinary-3.2.16; \
|
pecl install igbinary-3.2.16; \
|
||||||
pecl install --configureoptions 'enable-memcached-igbinary="yes"' \
|
|
||||||
pecl install memcached-3.4.0; \
|
pecl install memcached-3.4.0; \
|
||||||
pecl install redis-6.3.0; \
|
pecl install redis-6.3.0; \
|
||||||
pecl install --configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"' \
|
|
||||||
pecl install imagick-3.8.1; \
|
pecl install imagick-3.8.1; \
|
||||||
\
|
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
memcached \
|
|
||||||
igbinary \
|
igbinary \
|
||||||
imagick \
|
memcached \
|
||||||
redis \
|
redis \
|
||||||
bz2 \
|
imagick
|
||||||
|
|
||||||
|
############################
|
||||||
|
# STAGE 2 ? RUNTIME
|
||||||
|
############################
|
||||||
|
FROM php:8.4-apache-trixie
|
||||||
|
|
||||||
|
ARG NC_VERS
|
||||||
|
ENV NEXTCLOUD_VERSION=${NC_VERS}
|
||||||
|
|
||||||
|
# Runtime libraries ONLY (pas de -dev)
|
||||||
|
RUN set -eux; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
rsync \
|
||||||
|
bzip2 \
|
||||||
|
busybox-static \
|
||||||
|
ffmpeg \
|
||||||
|
ghostscript \
|
||||||
|
procps \
|
||||||
|
fontconfig \
|
||||||
|
exiftool \
|
||||||
|
libldap-common \
|
||||||
|
libmagickcore-7.q16-10-extra \
|
||||||
|
libzip5 \
|
||||||
|
libmemcached11 \
|
||||||
|
libicu76 \
|
||||||
|
libpq5 \
|
||||||
|
libfreetype6 \
|
||||||
|
libjpeg62-turbo \
|
||||||
|
libpng16-16 \
|
||||||
|
libwebp7 \
|
||||||
|
libgmp10 \
|
||||||
|
libbz2-1.0 \
|
||||||
|
imagemagick \
|
||||||
; \
|
; \
|
||||||
rm -r /tmp/pear; \
|
rm -rf /var/lib/apt/lists/*
|
||||||
apt-mark auto '.*' > /dev/null; \
|
|
||||||
apt-mark manual $savedAptMark; \
|
RUN set -ex; \
|
||||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
mkdir -p /var/spool/cron/crontabs; \
|
||||||
| awk '/=>/ { print $3 }' \
|
echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data
|
||||||
| sort -u \
|
|
||||||
| xargs -rt dpkg-query --search \
|
|
||||||
# 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)
|
|
||||||
| awk 'sub(":$", "", $1) { print $1 }' \
|
|
||||||
| sort -u \
|
|
||||||
| xargs -rt apt-mark manual;
|
|
||||||
|
|
||||||
|
|
||||||
|
# Copier extensions compilées
|
||||||
|
COPY --from=build /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
|
||||||
|
COPY --from=build /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
|
||||||
|
|
||||||
|
# Apache modules
|
||||||
|
RUN a2enmod headers rewrite remoteip
|
||||||
|
|
||||||
|
# PHP tuning
|
||||||
|
ENV PHP_MEMORY_LIMIT=2048M
|
||||||
|
ENV PHP_UPLOAD_LIMIT=2048M
|
||||||
|
|
||||||
|
############################
|
||||||
|
# INSTALL NEXTCLOUD
|
||||||
|
############################
|
||||||
|
RUN set -eux; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends curl gnupg dirmngr; \
|
||||||
|
curl -fsSL -o nextcloud.tar.bz2 \
|
||||||
|
"https://download.nextcloud.com/server/releases/nextcloud-${NC_VERS}.tar.bz2"; \
|
||||||
|
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||||
|
"https://download.nextcloud.com/server/releases/nextcloud-${NC_VERS}.tar.bz2.asc"; \
|
||||||
|
export GNUPGHOME="$(mktemp -d)"; \
|
||||||
|
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||||
|
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||||
|
tar -xjf nextcloud.tar.bz2 -C /var/www/; \
|
||||||
|
rm -rf "$GNUPGHOME" nextcloud.tar.bz2 nextcloud.tar.bz2.asc; \
|
||||||
|
rm -rf /var/www/nextcloud/updater; \
|
||||||
|
chown -R www-data:www-data /var/www/nextcloud
|
||||||
|
|
||||||
# set recommended PHP.ini settings
|
# set recommended PHP.ini settings
|
||||||
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
|
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
|
||||||
@@ -126,14 +160,10 @@ RUN { \
|
|||||||
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
|
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
|
||||||
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
|
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
|
||||||
\
|
\
|
||||||
mkdir /var/www/data; \
|
mkdir /var/www/data;
|
||||||
chown -R www-data:root /var/www; \
|
|
||||||
chmod -R g=u /var/www
|
|
||||||
|
|
||||||
VOLUME /var/www/html
|
|
||||||
|
|
||||||
RUN a2enmod headers rewrite remoteip ;\
|
RUN {\
|
||||||
{\
|
|
||||||
echo RemoteIPHeader X-Real-IP ;\
|
echo RemoteIPHeader X-Real-IP ;\
|
||||||
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
|
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
|
||||||
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
|
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
|
||||||
@@ -148,53 +178,13 @@ RUN { \
|
|||||||
} > /etc/apache2/conf-available/apache-limits.conf; \
|
} > /etc/apache2/conf-available/apache-limits.conf; \
|
||||||
a2enconf apache-limits
|
a2enconf apache-limits
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
ffmpeg \
|
|
||||||
ghostscript \
|
|
||||||
procps \
|
|
||||||
vim \
|
|
||||||
fontconfig \
|
|
||||||
exiftool \
|
|
||||||
gnupg; \
|
|
||||||
docker-php-ext-enable imagick
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
fetchDeps=" \
|
|
||||||
gnupg \
|
|
||||||
dirmngr \
|
|
||||||
"; \
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
|
||||||
\
|
|
||||||
curl -fsSL -o nextcloud.tar.bz2 \
|
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NC_VERS}.tar.bz2"; \
|
|
||||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
|
||||||
"https://download.nextcloud.com/server/releases/nextcloud-${NC_VERS}.tar.bz2.asc"; \
|
|
||||||
export GNUPGHOME="$(mktemp -d)"; \
|
|
||||||
# gpg key from https://nextcloud.com/nextcloud.asc \
|
|
||||||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
|
||||||
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
|
||||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
|
||||||
gpgconf --kill all; \
|
|
||||||
rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
|
||||||
rm -rf "$GNUPGHOME" /usr/src/nextcloud/updater; \
|
|
||||||
mkdir -p /usr/src/nextcloud/data; \
|
|
||||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
|
||||||
chmod +x /usr/src/nextcloud/occ;
|
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
RUN chmod +x /cron.sh
|
RUN chmod +x /cron.sh
|
||||||
|
|
||||||
COPY config/* /usr/src/nextcloud/config/
|
COPY config/* /usr/src/nextcloud/config/
|
||||||
|
|
||||||
ENV NEXTCLOUD_UPDATE=1
|
ENV NEXTCLOUD_UPDATE=1
|
||||||
ENV PHP_MEMORY_LIMIT=2048M
|
|
||||||
ENV PHP_UPLOAD_LIMIT=2048M
|
|
||||||
ENV extra_params=--o:net.proto=IPv4
|
ENV extra_params=--o:net.proto=IPv4
|
||||||
ENV NEXTCLOUD_VERSION ${NC_VERS}
|
|
||||||
|
|
||||||
RUN sh -x && \
|
RUN sh -x && \
|
||||||
for file in `convert -list policy | grep "Path:" | grep -v built | sed 's/Path: \(.*\)/\1/g'`; \
|
for file in `convert -list policy | grep "Path:" | grep -v built | sed 's/Path: \(.*\)/\1/g'`; \
|
||||||
@@ -202,10 +192,8 @@ RUN sh -x && \
|
|||||||
sed -i 's/domain="coder" rights="none" pattern="PDF"/domain="coder" rights="read|write" pattern="PDF"/g' $file ;\
|
sed -i 's/domain="coder" rights="none" pattern="PDF"/domain="coder" rights="read|write" pattern="PDF"/g' $file ;\
|
||||||
done
|
done
|
||||||
|
|
||||||
RUN set -ex; \
|
VOLUME /var/www/html
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["apache2-foreground"]
|
|
||||||
|
|
||||||
|
CMD ["apache2-foreground"]
|
||||||
Référencer dans un nouveau ticket
Bloquer un utilisateur