File Dockerfile of Package container-nextcloud

#!BuildTag: nextcloud-apache
FROM opensuse/bci/php-apache:latest

RUN zypper -n install --no-recommends nextcloud \
    php8-APCu \
    php8-bcmath \
    php8-exif \
    php8-gmp \
    php8-imagick \
    php8-pcntl \
    php8-pgsql \
    php8-redis \
    php8-sqlite \
    php8-sodium \
    php8-sysvsem \
    sqlite3 \
    rsync;

ENV NEXTCLOUD_INSTALL_DIR /srv/www/htdocs/nextcloud
ENV NEXTCLOUD_IMAGE_DIR /var/www/nextcloud

# move the installed nextcloud, required by entrypoint.sh
RUN mkdir -p $NEXTCLOUD_IMAGE_DIR
RUN mv $NEXTCLOUD_INSTALL_DIR /var/www/

ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M

# set recommended PHP.ini settings
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
RUN { \
        echo 'opcache.enable=1'; \
        echo 'opcache.enable_cli=1'; \
        echo 'opcache.interned_strings_buffer=32'; \
        echo 'opcache.max_accelerated_files=10000'; \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.save_comments=1'; \
        echo 'opcache.revalidate_freq=60'; \
        echo 'opcache.jit=1255'; \
        echo 'opcache.jit_buffer_size=128M'; \
    } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
    \
    echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
    \
    { \
        echo "memory_limit=${PHP_MEMORY_LIMIT}"; \
        echo "upload_max_filesize=${PHP_UPLOAD_LIMIT}"; \
        echo "post_max_size=${PHP_UPLOAD_LIMIT}"; \
    } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
    \
    mkdir -p /docker-entrypoint-hooks.d/pre-installation \
             /docker-entrypoint-hooks.d/post-installation \
             /docker-entrypoint-hooks.d/pre-upgrade \
             /docker-entrypoint-hooks.d/post-upgrade \
             /docker-entrypoint-hooks.d/before-starting;

# add apache config
RUN a2enmod headers; \
    a2enmod rewrite; \
    a2enmod remoteip; \
    { \
     echo 'RemoteIPHeader X-Real-IP'; \
     echo 'RemoteIPInternalProxy 10.0.0.0/8'; \
     echo 'RemoteIPInternalProxy 172.16.0.0/12'; \
     echo 'RemoteIPInternalProxy 192.168.0.0/16'; \
    } > /etc/apache2/conf.d/remoteip.conf;
ENV APACHE_BODY_LIMIT 1073741824
RUN { \
     echo "LimitRequestBody ${APACHE_BODY_LIMIT}"; \
    } > /etc/apache2/conf.d/apache-limits.conf;
COPY apache-nextcloud.conf /etc/apache2/vhosts.d/

# add nextcloud config
COPY autoconfig.php \
    apache-pretty-urls.config.php \
    apcu.config.php \
    apps.config.php \
    redis.config.php \
    reverse-proxy.config.php \
    s3.config.php \
    smtp.config.php \
    swift.config.php \
    upgrade-disable-web.config.php \
    $NEXTCLOUD_IMAGE_DIR/config/

COPY entrypoint.sh upgrade.exclude /
RUN chmod +x /entrypoint.sh

VOLUME $NEXTCLOUD_INSTALL_DIR
WORKDIR $NEXTCLOUD_INSTALL_DIR

ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]
openSUSE Build Service is sponsored by