From 4b1874fdd8365e8310d1775920db63bd0d442cb7 Mon Sep 17 00:00:00 2001 From: yzewei Date: Mon, 19 Aug 2024 14:26:05 +0800 Subject: [PATCH 1/3] add php 7.3.8 Signed-off-by: yzewei --- library/php/7.3.8-apache-buster/Dockerfile | 269 ++++++++++++++++++ .../php/7.3.8-apache-buster/Dockerfile.min | 170 +++++++++++ library/php/7.3.8-apache-buster/Makefile | 30 ++ .../7.3.8-apache-buster/apache2-foreground | 40 +++ .../7.3.8-apache-buster/docker-php-entrypoint | 9 + .../docker-php-ext-configure | 69 +++++ .../7.3.8-apache-buster/docker-php-ext-enable | 114 ++++++++ .../docker-php-ext-install | 122 ++++++++ .../php/7.3.8-apache-buster/docker-php-source | 34 +++ 9 files changed, 857 insertions(+) create mode 100644 library/php/7.3.8-apache-buster/Dockerfile create mode 100644 library/php/7.3.8-apache-buster/Dockerfile.min create mode 100644 library/php/7.3.8-apache-buster/Makefile create mode 100755 library/php/7.3.8-apache-buster/apache2-foreground create mode 100755 library/php/7.3.8-apache-buster/docker-php-entrypoint create mode 100755 library/php/7.3.8-apache-buster/docker-php-ext-configure create mode 100755 library/php/7.3.8-apache-buster/docker-php-ext-enable create mode 100755 library/php/7.3.8-apache-buster/docker-php-ext-install create mode 100755 library/php/7.3.8-apache-buster/docker-php-source diff --git a/library/php/7.3.8-apache-buster/Dockerfile b/library/php/7.3.8-apache-buster/Dockerfile new file mode 100644 index 00000000..8a0390f8 --- /dev/null +++ b/library/php/7.3.8-apache-buster/Dockerfile @@ -0,0 +1,269 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM cr.loongnix.cn/library/debian:buster-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html + +#### +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends apache2; \ + rm -rf /var/lib/apt/lists/*; \ + \ +# generically convert lines like +# export APACHE_RUN_USER=www-data +# into +# : ${APACHE_RUN_USER:=www-data} +# export APACHE_RUN_USER +# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") + sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ + \ +# setup directories and permissions + . "$APACHE_ENVVARS"; \ + for dir in \ + "$APACHE_LOCK_DIR" \ + "$APACHE_RUN_DIR" \ + "$APACHE_LOG_DIR" \ + ; do \ + rm -rvf "$dir"; \ + mkdir -p "$dir"; \ + chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + chmod 777 "$dir"; \ + done; \ + \ +# delete the "index.html" that installing Apache drops in here + rm -rvf /var/www/html/*; \ + \ +# logs should go to stdout / stderr + ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ + chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" + +# Apache + PHP requires preforking Apache for best results +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# PHP files should be handled by PHP, and should be preferred over any other file type +RUN { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php + +ENV PHP_EXTRA_BUILD_DEPS apache2-dev +ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D + +ENV PHP_VERSION 7.3.8 +ENV PHP_URL="https://www.php.net/get/php-7.3.8.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-7.3.8.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="f6046b2ae625d8c04310bda0737ac660dc5563a8e04e8a46c1ee24ea414ad5a5" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libargon2-0 \ + libargon2-1 \ + libcurl4-openssl-dev \ + libedit-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + libpng-dev libmagickwand-dev libmemcached-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + wget -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; \ + wget -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' ; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 'loongarch64-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-mark manual libargon2-dev libfreetype6-dev libmagickwand-6.q16-6 libicu67 libmemcached11 libmemcached-dev libedit-dev libsodium-dev; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + rm -rf /var/lib/apt/lists/* ; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +# temporary "freetype-config" workaround for https://github.com/docker-library/php/issues/865 (https://bugs.php.net/bug.php?id=76324) +RUN { echo '#!/bin/sh'; echo 'exec pkg-config "$@" freetype2'; } > /usr/local/bin/freetype-config && chmod +x /usr/local/bin/freetype-config + +ENTRYPOINT ["docker-php-entrypoint"] +#### +COPY apache2-foreground /usr/local/bin/ +WORKDIR /var/www/html + +EXPOSE 80 +CMD ["apache2-foreground"] +#### diff --git a/library/php/7.3.8-apache-buster/Dockerfile.min b/library/php/7.3.8-apache-buster/Dockerfile.min new file mode 100644 index 00000000..2972010d --- /dev/null +++ b/library/php/7.3.8-apache-buster/Dockerfile.min @@ -0,0 +1,170 @@ +# Stage 1: Build PHP +FROM cr.loongnix.cn/library/debian:buster-slim AS build + +# prevent Debian's PHP packages from being installed +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php +COPY docker-php-source /usr/local/bin +# dependencies required for running "phpize" +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + wget \ + xz-utils \ + gnupg dirmngr \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + # Download and verify PHP source code + curl -fsSL -o php.tar.xz "https://www.php.net/get/php-7.3.8.tar.xz/from/this/mirror"; \ + curl -fsSL -o php.tar.xz.asc "https://www.php.net/get/php-7.3.8.tar.xz.asc/from/this/mirror"; \ + export GNUPGHOME="$(mktemp -d)"; \ +# gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D; \ +# gpg --batch --verify php.tar.xz.asc php.tar.xz; \ +# gpgconf --kill all; \ +# rm -rf "$GNUPGHOME"; \ +# \ + # Extract and build PHP + tar -xf php.tar.xz; \ + cd php-7.3.8; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ + wget -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; \ + wget -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' ; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + --enable-option-checking=fatal \ + --with-mhash \ + --enable-ftp \ + --enable-mbstring \ + --enable-mysqlnd \ + --with-password-argon2 \ + --with-sodium=shared \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + $(test "$gnuArch" = 'loongarch64-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ +# --with-libdir="lib/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# --with-apxs2 \ + ; \ + make -j "$(nproc)"; \ + make install; \ + cp -v php.ini-* "$PHP_INI_DIR/"; \ + make clean; \ + docker-php-source delete; \ + \ + ldd /usr/local/bin/php | awk '/=>/ { print $(NF-1) }' | sort -u > /usr/src/libs.txt; \ + mkdir -p /usr/src/libs; \ + xargs -a /usr/src/libs.txt -I{} cp --parents {} /usr/src/libs/; \ + # Clean up unnecessary files and packages + rm -rf /var/lib/apt/lists/*; \ + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + php --version + +# Stage 2: Final image with Apache and PHP +FROM cr.loongnix.cn/library/debian:buster-slim + +# Set environment variables +ENV PHP_INI_DIR /usr/local/etc/php +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +# Install runtime dependencies and Apache +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends apache2 libsodium-dev; \ + rm -rf /var/lib/apt/lists/*; \ + \ + # Setup directories and permissions + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html; \ + \ + # Delete default index.html + rm -rvf /var/www/html/*; \ + \ + # Logs should go to stdout / stderr + ln -sfT /dev/stderr /var/log/apache2/error.log; \ + ln -sfT /dev/stdout /var/log/apache2/access.log; \ + ln -sfT /dev/stdout /var/log/apache2/other_vhosts_access.log; \ + \ + # Enable Apache modules + a2dismod mpm_event && a2enmod mpm_prefork; \ + { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php; + # Copy PHP from the build stage + COPY --from=build /usr/local /usr/local + COPY --from=build /usr/src /usr/src + COPY --from=build /usr/src/libs/lib/loongarch64-linux-gnu/libbsd.so.0 /lib/loongarch64-linux-gnu/ + COPY --from=build /usr/src/libs/lib/loongarch64-linux-gnu/libargon2.so.1 /lib/loongarch64-linux-gnu/ + COPY --from=build /usr/src/libs/lib/loongarch64-linux-gnu/libedit.so.2 /lib/loongarch64-linux-gnu/ +# COPY --from=build /usr/src/libs/lib/loongarch64-linux-gnu/libsodium.so.23 /lib/loongarch64-linux-gnu/ + # Copy entrypoints and set permissions + COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + + RUN docker-php-ext-enable sodium + + RUN { echo '#!/bin/sh'; echo 'exec pkg-config "$@" freetype2'; } > /usr/local/bin/freetype-config && chmod +x /usr/local/bin/freetype-config + + ENTRYPOINT ["docker-php-entrypoint"] + + COPY apache2-foreground /usr/local/bin/ + + WORKDIR /var/www/html + + EXPOSE 80 + + CMD ["apache2-foreground"] + diff --git a/library/php/7.3.8-apache-buster/Makefile b/library/php/7.3.8-apache-buster/Makefile new file mode 100644 index 00000000..b8256cc2 --- /dev/null +++ b/library/php/7.3.8-apache-buster/Makefile @@ -0,0 +1,30 @@ +# This file is generated by the template. + +REGISTRY?=cr.loongnix.cn +ORGANIZATION?=library +REPOSITORY?=php +TAG?=7.3-apache-buster +LATEST?=false + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +default: image +# Dockerfile 经过修改,镜像体积缩小为414MB +# 按照官方Dockerfile构建参考Dockerfile.buster 构建镜像大小为1.48GB +image: + docker buildx build \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + --load \ + . + +push: + docker push $(IMAGE) + #latest image + @if [ $(LATEST) = "true" ]; \ + then \ + docker tag $(IMAGE) $(LATEST_IMAGE); \ + docker push $(LATEST_IMAGE); \ + fi diff --git a/library/php/7.3.8-apache-buster/apache2-foreground b/library/php/7.3.8-apache-buster/apache2-foreground new file mode 100755 index 00000000..5fe22e26 --- /dev/null +++ b/library/php/7.3.8-apache-buster/apache2-foreground @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. +# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) + +: "${APACHE_CONFDIR:=/etc/apache2}" +: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" +if test -f "$APACHE_ENVVARS"; then + . "$APACHE_ENVVARS" +fi + +# Apache gets grumpy about PID files pre-existing +: "${APACHE_RUN_DIR:=/var/run/apache2}" +: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" +rm -f "$APACHE_PID_FILE" + +# create missing directories +# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) +for e in "${!APACHE_@}"; do + if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then + # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir + # mkdir: cannot create directory '/var/lock': File exists + dir="${!e}" + while [ "$dir" != "$(dirname "$dir")" ]; do + dir="$(dirname "$dir")" + if [ -d "$dir" ]; then + break + fi + absDir="$(readlink -f "$dir" 2>/dev/null || :)" + if [ -n "$absDir" ]; then + mkdir -p "$absDir" + fi + done + + mkdir -p "${!e}" + fi +done + +exec apache2 -DFOREGROUND "$@" diff --git a/library/php/7.3.8-apache-buster/docker-php-entrypoint b/library/php/7.3.8-apache-buster/docker-php-entrypoint new file mode 100755 index 00000000..3d36d5e8 --- /dev/null +++ b/library/php/7.3.8-apache-buster/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/library/php/7.3.8-apache-buster/docker-php-ext-configure b/library/php/7.3.8-apache-buster/docker-php-ext-configure new file mode 100755 index 00000000..9e949e1e --- /dev/null +++ b/library/php/7.3.8-apache-buster/docker-php-ext-configure @@ -0,0 +1,69 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [configure flags]" + echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; then + usage >&2 + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +cd "$ext" +phpize +./configure "$@" diff --git a/library/php/7.3.8-apache-buster/docker-php-ext-enable b/library/php/7.3.8-apache-buster/docker-php-ext-enable new file mode 100755 index 00000000..3d079d21 --- /dev/null +++ b/library/php/7.3.8-apache-buster/docker-php-ext-enable @@ -0,0 +1,114 @@ +#!/bin/sh +set -e + +extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" +cd "$extDir" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + find -maxdepth 1 \ + -type f \ + -name '*.so' \ + -exec basename '{}' ';' \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: '$module' does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + absModule="$(readlink -f "$module")" + line="zend_extension=$absModule" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi diff --git a/library/php/7.3.8-apache-buster/docker-php-ext-install b/library/php/7.3.8-apache-buster/docker-php-ext-install new file mode 100755 index 00000000..1afa6627 --- /dev/null +++ b/library/php/7.3.8-apache-buster/docker-php-ext-install @@ -0,0 +1,122 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/library/php/7.3.8-apache-buster/docker-php-source b/library/php/7.3.8-apache-buster/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/library/php/7.3.8-apache-buster/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac From 5bafb2be3a1c517edfa8f7e52fb8a3f569daf4af Mon Sep 17 00:00:00 2001 From: yzewei Date: Mon, 19 Aug 2024 14:26:45 +0800 Subject: [PATCH 2/3] add nextcloud 19 Signed-off-by: yzewei --- library/nextcloud/19.0-beta/Dockerfile | 154 ++++++++++++++ library/nextcloud/19.0-beta/Makefile | 20 ++ .../config/apache-pretty-urls.config.php | 4 + .../19.0-beta/config/apcu.config.php | 4 + .../19.0-beta/config/apps.config.php | 15 ++ .../nextcloud/19.0-beta/config/autoconfig.php | 31 +++ .../19.0-beta/config/redis.config.php | 17 ++ .../19.0-beta/config/reverse-proxy.config.php | 25 +++ .../19.0-beta/config/smtp.config.php | 15 ++ library/nextcloud/19.0-beta/cron.sh | 4 + library/nextcloud/19.0-beta/entrypoint.sh | 192 ++++++++++++++++++ library/nextcloud/19.0-beta/upgrade.exclude | 5 + 12 files changed, 486 insertions(+) create mode 100644 library/nextcloud/19.0-beta/Dockerfile create mode 100644 library/nextcloud/19.0-beta/Makefile create mode 100644 library/nextcloud/19.0-beta/config/apache-pretty-urls.config.php create mode 100644 library/nextcloud/19.0-beta/config/apcu.config.php create mode 100644 library/nextcloud/19.0-beta/config/apps.config.php create mode 100644 library/nextcloud/19.0-beta/config/autoconfig.php create mode 100644 library/nextcloud/19.0-beta/config/redis.config.php create mode 100644 library/nextcloud/19.0-beta/config/reverse-proxy.config.php create mode 100644 library/nextcloud/19.0-beta/config/smtp.config.php create mode 100755 library/nextcloud/19.0-beta/cron.sh create mode 100755 library/nextcloud/19.0-beta/entrypoint.sh create mode 100644 library/nextcloud/19.0-beta/upgrade.exclude diff --git a/library/nextcloud/19.0-beta/Dockerfile b/library/nextcloud/19.0-beta/Dockerfile new file mode 100644 index 00000000..d14ea788 --- /dev/null +++ b/library/nextcloud/19.0-beta/Dockerfile @@ -0,0 +1,154 @@ +# DO NOT EDIT: created by update.sh from Dockerfile-debian.template +#FROM php:7.3-apache-buster +#FROM cr.loongnix.cn/library/php:7.4.30-apache +FROM cr.loongnix.cn/library/php:7.3-apache-buster + +# entrypoint.sh and cron.sh dependencies +RUN set -ex; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + rsync \ + bzip2 \ + busybox-static \ + ; \ + 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 +RUN set -ex; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libevent-dev \ + libfreetype6-dev \ + libicu-dev \ + libjpeg-dev \ + libldap2-dev \ + libmcrypt-dev \ + libmemcached-dev \ + libpng-dev \ + libpq-dev \ + libxml2-dev \ + libmagickwand-dev \ + libzip-dev \ + libwebp-dev \ + libgmp-dev \ + dpkg-dev \ + ; \ + \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ + if [ ! -e /usr/include/gmp.h ]; then ln -s /usr/include/$debMultiarch/gmp.h /usr/include/gmp.h; fi;\ + docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr; \ + docker-php-ext-configure gmp --with-gmp="/usr/include/$debMultiarch"; \ + docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \ + docker-php-ext-install -j "$(nproc)" \ + exif \ + gd \ + intl \ + ldap \ + opcache \ + pcntl \ + pdo_mysql \ + pdo_pgsql \ + zip \ + gmp \ + ; \ + \ +# pecl will claim success even if one install fails, so we need to perform each install separately + pecl install APCu-5.1.18; \ + pecl install memcached-3.1.5; \ + pecl install redis-4.3.0; \ + pecl install imagick-3.4.4; \ + \ + docker-php-ext-enable \ + apcu \ + memcached \ + redis \ + imagick \ + ; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* + +# set recommended PHP.ini settings +# see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html#enable-php-opcache +RUN { \ + echo 'opcache.enable=1'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=10000'; \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.save_comments=1'; \ + echo 'opcache.revalidate_freq=1'; \ + } > /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; \ + chown -R www-data:root /var/www; \ + chmod -R g=u /var/www + +VOLUME /var/www/html + +RUN a2enmod headers rewrite remoteip ;\ + {\ + echo RemoteIPHeader X-Real-IP ;\ + echo RemoteIPTrustedProxy 10.0.0.0/8 ;\ + echo RemoteIPTrustedProxy 172.16.0.0/12 ;\ + echo RemoteIPTrustedProxy 192.168.0.0/16 ;\ + } > /etc/apache2/conf-available/remoteip.conf;\ + a2enconf remoteip + +ENV NEXTCLOUD_VERSION 19.0.0beta5 + +RUN set -ex; \ + fetchDeps=" \ + gnupg \ + dirmngr \ + "; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + \ + curl --retry 16 -fsSL -o nextcloud.tar.bz2 \ + "https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \ + curl -fsSL -o nextcloud.tar.bz2.asc \ + "https://download.nextcloud.com/server/prereleases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ +# gpg key from https://nextcloud.com/nextcloud.asc +# gpg --batch --keyserver ha.pool.sks-keyservers.net --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 -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \ + rm -rf /usr/src/nextcloud/updater; \ + mkdir -p /usr/src/nextcloud/data; \ + mkdir -p /usr/src/nextcloud/custom_apps; \ + 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 upgrade.exclude / +COPY config/* /usr/src/nextcloud/config/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["apache2-foreground"] diff --git a/library/nextcloud/19.0-beta/Makefile b/library/nextcloud/19.0-beta/Makefile new file mode 100644 index 00000000..88791329 --- /dev/null +++ b/library/nextcloud/19.0-beta/Makefile @@ -0,0 +1,20 @@ +# This file is generated by the template. + +REGISTRY?=cr.loongnix.cn +ORGANIZATION?=library +REPOSITORY?=nextcloud +TAG?=19 + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) + + +default: image + +image: + docker build \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE) diff --git a/library/nextcloud/19.0-beta/config/apache-pretty-urls.config.php b/library/nextcloud/19.0-beta/config/apache-pretty-urls.config.php new file mode 100644 index 00000000..72da1d8c --- /dev/null +++ b/library/nextcloud/19.0-beta/config/apache-pretty-urls.config.php @@ -0,0 +1,4 @@ + '/', +); diff --git a/library/nextcloud/19.0-beta/config/apcu.config.php b/library/nextcloud/19.0-beta/config/apcu.config.php new file mode 100644 index 00000000..69fed876 --- /dev/null +++ b/library/nextcloud/19.0-beta/config/apcu.config.php @@ -0,0 +1,4 @@ + '\OC\Memcache\APCu', +); diff --git a/library/nextcloud/19.0-beta/config/apps.config.php b/library/nextcloud/19.0-beta/config/apps.config.php new file mode 100644 index 00000000..a4bed833 --- /dev/null +++ b/library/nextcloud/19.0-beta/config/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/library/nextcloud/19.0-beta/config/autoconfig.php b/library/nextcloud/19.0-beta/config/autoconfig.php new file mode 100644 index 00000000..deeabe4e --- /dev/null +++ b/library/nextcloud/19.0-beta/config/autoconfig.php @@ -0,0 +1,31 @@ + '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis' => array( + 'host' => getenv('REDIS_HOST'), + 'password' => getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_PORT') !== false) { + $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT'); + } elseif (getenv('REDIS_HOST')[0] != '/') { + $CONFIG['redis']['port'] = 6379; + } +} diff --git a/library/nextcloud/19.0-beta/config/reverse-proxy.config.php b/library/nextcloud/19.0-beta/config/reverse-proxy.config.php new file mode 100644 index 00000000..667be312 --- /dev/null +++ b/library/nextcloud/19.0-beta/config/reverse-proxy.config.php @@ -0,0 +1,25 @@ + 'smtp', + 'mail_smtphost' => getenv('SMTP_HOST'), + 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), + 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), + 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', + 'mail_smtpname' => getenv('SMTP_NAME') ?: '', + 'mail_smtppassword' => getenv('SMTP_PASSWORD') ?: '', + 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), + 'mail_domain' => getenv('MAIL_DOMAIN'), + ); +} diff --git a/library/nextcloud/19.0-beta/cron.sh b/library/nextcloud/19.0-beta/cron.sh new file mode 100755 index 00000000..4dfa4118 --- /dev/null +++ b/library/nextcloud/19.0-beta/cron.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/library/nextcloud/19.0-beta/entrypoint.sh b/library/nextcloud/19.0-beta/entrypoint.sh new file mode 100755 index 00000000..07b44d61 --- /dev/null +++ b/library/nextcloud/19.0-beta/entrypoint.sh @@ -0,0 +1,192 @@ +#!/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 +} + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + if [ -n "${varValue}" ]; then + export "$var"="${varValue}" + elif [ -n "${fileVarValue}" ]; then + export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${def}" ]; then + export "$var"="$def" + fi + unset "$fileVar" +} + +if expr "$1" : "apache" 1>/dev/null; then + if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then + a2disconf remoteip + fi +fi + +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then + if [ -n "${REDIS_HOST+x}" ]; then + + echo "Configuring Redis as session handler" + { + echo 'session.save_handler = redis' + # check if redis host is an unix socket path + if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then + if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then + echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" + else + echo "session.save_path = \"unix://${REDIS_HOST}\"" + fi + # check if redis password has been set + elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then + echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + else + echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + fi + } > /usr/local/etc/php/conf.d/redis-session.ini + 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 + 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 + rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ + echo "Initializing finished" + + #install + if [ "$installed_version" = "0.0.0.0" ]; then + echo "New nextcloud instance" + + file_env NEXTCLOUD_ADMIN_PASSWORD + file_env NEXTCLOUD_ADMIN_USER + + 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"' + fi + if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then + # shellcheck disable=SC2016 + install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"' + fi + + file_env MYSQL_DATABASE + file_env MYSQL_PASSWORD + file_env MYSQL_USER + file_env POSTGRES_DB + file_env POSTGRES_PASSWORD + file_env POSTGRES_USER + + 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 nextcloud 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 10s + 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 "$@" diff --git a/library/nextcloud/19.0-beta/upgrade.exclude b/library/nextcloud/19.0-beta/upgrade.exclude new file mode 100644 index 00000000..354864da --- /dev/null +++ b/library/nextcloud/19.0-beta/upgrade.exclude @@ -0,0 +1,5 @@ +/config/ +/data/ +/custom_apps/ +/themes/ +/version.php From a55718750279b74b52c47b8a8431f407210c1acb Mon Sep 17 00:00:00 2001 From: yzewei Date: Tue, 15 Oct 2024 09:46:22 +0800 Subject: [PATCH 3/3] add kong 2.6.0 Signed-off-by: yzewei --- library/kong/kong-2.6.0-centos/.Makefile.swo | Bin 0 -> 12288 bytes library/kong/kong-2.6.0-centos/.gitignore | 1 + .../0001-port-to-loong64.patch | 49 +++ .../0002-port-to-loong64.patch | 385 ++++++++++++++++++ library/kong/kong-2.6.0-centos/0003.patch | 25 ++ library/kong/kong-2.6.0-centos/Makefile | 67 +++ 6 files changed, 527 insertions(+) create mode 100644 library/kong/kong-2.6.0-centos/.Makefile.swo create mode 100644 library/kong/kong-2.6.0-centos/.gitignore create mode 100644 library/kong/kong-2.6.0-centos/0001-port-to-loong64.patch create mode 100644 library/kong/kong-2.6.0-centos/0002-port-to-loong64.patch create mode 100644 library/kong/kong-2.6.0-centos/0003.patch create mode 100644 library/kong/kong-2.6.0-centos/Makefile diff --git a/library/kong/kong-2.6.0-centos/.Makefile.swo b/library/kong/kong-2.6.0-centos/.Makefile.swo new file mode 100644 index 0000000000000000000000000000000000000000..7dbcc3631c729959d99e0db50d9cd58f6b76b10e GIT binary patch literal 12288 zcmeI2%WoT16vj_kPz;o(fK{cN)@nScGvkD|s!XSeo4Uc|F_j;s_SK8gPw#MQS)8he4Vwc>2J7JBeH1MfZ zDvlPiC`*Q{Tv@Gm8tqQ6xmI6pXiu`|cMMWz1LMWObi;JWLpUt@1NPjug~lv)D2+3I zh`o@{cXPaAK9bR8Mx_luWlj_Y*O+0L_$gP;*E>s3_0HL?-ip1x+&j~4uAc36Y zQOWgKd66ACA`_LaZXiO=^ghDhYTdigXtkU6y2f+VwtIkGCf&2*v-Z+TqbU3~ik%vNVv63BG|(P-!CFnWMqcXn zFOxN+WH*{RVu~z{vebOsh@%lJpEAdXQRVSed5cPDy=k`>gXHffr0v!%SJvt)4XoSJ zRC^XV?xwTBbs3T5n~tzWJ=^6W|E-;H%XHf&EMH|+Ru2SpIdRO0oYWmoculm2 zbeP-4p=c6oD_`yo1(Kg|zNxofVa}CJrk`W8<}90iIg0%-W##hvx$CoRXUv!!o4YAer7cL@;U7j3ee(vTvDfgJ13OiW3wz^9VZO2tU%!;sC9LVWCaU~3d github-token; \ + docker pull --quiet $$(sed -ne 's;FROM \(.*$(PACKAGE_TYPE).*\) as.*;\1;p' dockerfiles/Dockerfile.openresty); \ +@@ -251,6 +255,8 @@ else + --build-arg OPENRESTY_PATCHES=$(OPENRESTY_PATCHES) \ + --build-arg DEBUG=$(DEBUG) \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ ++ --build-arg http_proxy=$(HTTP_PROXY) \ ++ --build-arg https_proxy=$(HTTPS_PROXY) \ + -t $(DOCKER_REPOSITORY):openresty-$(PACKAGE_TYPE)-$(DOCKER_OPENRESTY_SUFFIX) . && \ + ( \ + rm github-token || true \ +@@ -265,7 +271,7 @@ else + package-kong: actual-package-kong + endif + +-actual-package-kong: cleanup setup-build ++actual-package-kong: setup-build + ifeq ($(DEBUG),1) + exit 1 + endif +@@ -285,6 +291,8 @@ endif + --build-arg PACKAGE_PROVIDES=$(PACKAGE_PROVIDES) \ + --build-arg PACKAGE_REPLACES=$(PACKAGE_REPLACES) \ + --build-arg SSL_PROVIDER=$(SSL_PROVIDER) \ ++ --build-arg http_proxy=$(HTTP_PROXY) \ ++ --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg PRIVATE_KEY_FILE=kong.private.gpg-key.asc \ + --build-arg PRIVATE_KEY_PASSPHRASE="$(PRIVATE_KEY_PASSPHRASE)" \ + -t $(DOCKER_REPOSITORY):kong-packaged-$(PACKAGE_TYPE)-$(DOCKER_KONG_SUFFIX) . +@@ -318,7 +326,6 @@ kong-ci-cache-key: + + actual-build-kong: setup-kong-source + touch id_rsa.private +- $(CACHE_COMMAND) $(DOCKER_REPOSITORY):kong-$(PACKAGE_TYPE)-$(DOCKER_KONG_SUFFIX) || \ + ( $(MAKE) build-openresty && \ + -rm github-token; \ + echo $$GITHUB_TOKEN > github-token; \ +@@ -328,6 +335,8 @@ actual-build-kong: setup-kong-source + --build-arg DOCKER_REPOSITORY=$(DOCKER_REPOSITORY) \ + --build-arg DOCKER_OPENRESTY_SUFFIX=$(DOCKER_OPENRESTY_SUFFIX) \ + --build-arg ENABLE_LJBC=$(ENABLE_LJBC) \ ++ --build-arg http_proxy=$(HTTP_PROXY) \ ++ --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ + --build-arg SSL_PROVIDER=$(SSL_PROVIDER) \ + -t $(DOCKER_REPOSITORY):kong-$(PACKAGE_TYPE)-$(DOCKER_KONG_SUFFIX) . ) +diff --git a/build-kong.sh b/build-kong.sh +index af75650..7093c45 100755 +--- a/build-kong.sh ++++ b/build-kong.sh +@@ -1,7 +1,6 @@ + #!/bin/bash + + set -e +- + source /common.sh + + ROCKS_CONFIG=$(mktemp) +@@ -64,7 +63,7 @@ pushd /kong + cp kong/pluginsocket.proto /tmp/build/usr/local/kong/include/kong + fi + +- with_backoff curl -fsSLo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.19.0/protoc-3.19.0-linux-x86_64.zip ++ with_backoff curl -fsSLo /tmp/protoc.zip https://github.com/Loongson-Cloud-Community/protobuf/releases/download/v3.19.0/protoc-3.19.0-linux-loongarch_64.zip + unzip -o /tmp/protoc.zip -d /tmp/protoc 'include/*' + cp -r /tmp/protoc/include/google /tmp/build/usr/local/kong/include/ + popd +diff --git a/dockerfiles/Dockerfile.kong b/dockerfiles/Dockerfile.kong +index 69f8138..c38aa99 100644 +--- a/dockerfiles/Dockerfile.kong ++++ b/dockerfiles/Dockerfile.kong +@@ -6,6 +6,9 @@ ARG DOCKER_REPOSITORY + + FROM ${DOCKER_REPOSITORY}:openresty-${PACKAGE_TYPE}-${DOCKER_OPENRESTY_SUFFIX} + ++ARG http_proxy ++ARG https_proxy ++ + ARG ENABLE_LJBC= + ENV ENABLE_LJBC $ENABLE_LJBC + +@@ -22,4 +25,5 @@ RUN --mount=type=secret,id=github-token if [ -f "/distribution/post-install.sh" + WORKDIR /kong + COPY openresty-build-tools/common.sh /common.sh + COPY build-kong.sh /build-kong.sh ++RUN git config --global url."https://".insteadOf git:// + RUN /build-kong.sh +diff --git a/dockerfiles/Dockerfile.openresty b/dockerfiles/Dockerfile.openresty +index 85e9ea9..2923370 100644 +--- a/dockerfiles/Dockerfile.openresty ++++ b/dockerfiles/Dockerfile.openresty +@@ -4,9 +4,9 @@ ARG DOCKER_BASE_SUFFIX + ARG DOCKER_REPOSITORY + ARG PACKAGE_TYPE + +-FROM kong/kong-build-tools:apk-1.8.1 as APK +-FROM kong/kong-build-tools:deb-1.8.1 as DEB +-FROM kong/kong-build-tools:rpm-1.8.1 as RPM ++#FROM kong/kong-build-tools:apk-1.8.1 as APK ++#FROM kong/kong-build-tools:deb-1.8.1 as DEB ++FROM cr.loongnix.cn/kong/kong-build-tools:rpm-1.8.1 as RPM + + FROM $PACKAGE_TYPE + +diff --git a/dockerfiles/Dockerfile.package b/dockerfiles/Dockerfile.package +index 26af7db..df7aacc 100644 +--- a/dockerfiles/Dockerfile.package ++++ b/dockerfiles/Dockerfile.package +@@ -5,7 +5,7 @@ ARG DOCKER_REPOSITORY + + FROM ${DOCKER_REPOSITORY}:kong-${PACKAGE_TYPE}-${DOCKER_KONG_SUFFIX} as KONG + +-FROM kong/fpm:0.5.1 as FPM ++FROM cr.loongnix.cn/kong/fpm:0.5.1 as FPM + + COPY --from=KONG /tmp/build /tmp/build + COPY fpm-entrypoint.sh sign-rpm.exp .rpmmacros / +@@ -46,5 +46,5 @@ COPY kong.logrotate /tmp/build/etc/kong/kong.logrotate + + RUN /fpm-entrypoint.sh + +-FROM alpine ++FROM cr.loongnix.cn/library/alpine:3.11 + COPY --from=FPM /output /output +diff --git a/id_rsa b/id_rsa +deleted file mode 120000 +index 32b331c..0000000 +--- a/id_rsa ++++ /dev/null +@@ -1 +0,0 @@ +-id_rsa.private +\ No newline at end of file +diff --git a/id_rsa b/id_rsa +new file mode 100644 +index 0000000..e69de29 +diff --git a/openresty-build-tools/kong-ngx-build b/openresty-build-tools/kong-ngx-build +index 73b2cb6..0302e5a 100755 +--- a/openresty-build-tools/kong-ngx-build ++++ b/openresty-build-tools/kong-ngx-build +@@ -1,6 +1,6 @@ + #!/usr/bin/env bash + +-set -e ++set -ex + + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + source $SCRIPT_DIR/common.sh +@@ -257,7 +257,9 @@ main() { + package_architecture=x86_64 + if [ "$(arch)" == "aarch64" ]; then + package_architecture=aarch64 +- fi ++ #elif [ "$(arch)" == "loongarch64" ]; then ++ # package_architecture=loongarch64 ++ fi + with_backoff curl --fail -sSLo openssl.tar.gz https://github.com/Kong/kong-openssl/releases/download/$KONG_OPENSSL_VER/$package_architecture-$OSTYPE.tar.gz + tar -C /tmp/build -xvf openssl.tar.gz + elif [ "$OPENSSL_VER" != 0 -a "$SSL_PROVIDER" = "openssl" ]; then +@@ -324,6 +326,16 @@ main() { + notice "Downloaded: $(sha256sum "openresty-$OPENRESTY_VER.tar.gz")" + fi + tar -xzf openresty-$OPENRESTY_VER.tar.gz ++ pushd openresty-$OPENRESTY_VER/bundle ++ if [ -e LuaJIT-2.1-20201027 ];then ++ rm -r LuaJIT-2.1-20201027 ++ fi ++ https_proxy=http://10.2.10.197:7890 git clone -b v2.1-agentzh-larch64 --depth 1 https://github.com/loongson/luajit2.git ++ mv luajit2 LuaJIT-2.1-20201027 ++ if [ -e LuaJIT-2.1-20210510 ];then ++ rm -r LuaJIT-2.1-20210510 ++ fi ++ popd + ln -s openresty-$OPENRESTY_VER openresty + + # use unreleased version of lua-resty-dns +@@ -368,6 +380,10 @@ main() { + notice "Downloaded: $(sha256sum "pcre-${PCRE_VER}.tar.gz")" + fi + tar -xzf pcre-${PCRE_VER}.tar.gz ++ pushd pcre-${PCRE_VER} ++ wget -O ./config.sub "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" ++ wget -O ./config.guess "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" ++ popd + ln -s pcre-${PCRE_VER} pcre + fi + fi +@@ -769,7 +785,7 @@ main() { + + OPENRESTY_OPTS=( + "--prefix=$OPENRESTY_PREFIX" +- "--with-pcre-jit" ++ #"--with-pcre-jit" + "--with-http_ssl_module" + "--with-http_sub_module" + "--with-http_realip_module" +diff --git a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_01-ffi-arm64-macos-fix-vararg-call-handling.patch b/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_01-ffi-arm64-macos-fix-vararg-call-handling.patch +deleted file mode 100644 +index b2037cc..0000000 +--- a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_01-ffi-arm64-macos-fix-vararg-call-handling.patch ++++ /dev/null +@@ -1,62 +0,0 @@ +-From 521b367567dc5d91d7f9ae29c257998953e24e53 Mon Sep 17 00:00:00 2001 +-From: Mike Pall +-Date: Sun, 2 May 2021 22:11:05 +0200 +-Subject: [PATCH] FFI/ARM64/OSX: Fix vararg call handling. +- +-Thanks to Igor Munkin. +---- +- LuaJIT-2.1-20210510/src/lj_ccall.c | 8 ++++---- +- LuaJIT-2.1-20210510/src/lj_ccallback.c | 2 +- +- 2 files changed, 5 insertions(+), 5 deletions(-) +- +-diff --git a/LuaJIT-2.1-20210510/src/lj_ccall.c b/LuaJIT-2.1-20210510/src/lj_ccall.c +-index a91ffc7e..3c029823 100644 +---- a/LuaJIT-2.1-20210510/src/lj_ccall.c +-+++ b/LuaJIT-2.1-20210510/src/lj_ccall.c +-@@ -334,7 +334,7 @@ +- isfp = sz == 2*sizeof(float) ? 2 : 1; +- +- #define CCALL_HANDLE_REGARG \ +-- if (LJ_TARGET_IOS && isva) { \ +-+ if (LJ_TARGET_OSX && isva) { \ +- /* IOS: All variadic arguments are on the stack. */ \ +- } else if (isfp) { /* Try to pass argument in FPRs. */ \ +- int n2 = ctype_isvector(d->info) ? 1 : \ +-@@ -345,10 +345,10 @@ +- goto done; \ +- } else { \ +- nfpr = CCALL_NARG_FPR; /* Prevent reordering. */ \ +-- if (LJ_TARGET_IOS && d->size < 8) goto err_nyi; \ +-+ if (LJ_TARGET_OSX && d->size < 8) goto err_nyi; \ +- } \ +- } else { /* Try to pass argument in GPRs. */ \ +-- if (!LJ_TARGET_IOS && (d->info & CTF_ALIGN) > CTALIGN_PTR) \ +-+ if (!LJ_TARGET_OSX && (d->info & CTF_ALIGN) > CTALIGN_PTR) \ +- ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \ +- if (ngpr + n <= maxgpr) { \ +- dp = &cc->gpr[ngpr]; \ +-@@ -356,7 +356,7 @@ +- goto done; \ +- } else { \ +- ngpr = maxgpr; /* Prevent reordering. */ \ +-- if (LJ_TARGET_IOS && d->size < 8) goto err_nyi; \ +-+ if (LJ_TARGET_OSX && d->size < 8) goto err_nyi; \ +- } \ +- } +- +-diff --git a/LuaJIT-2.1-20210510/src/lj_ccallback.c b/LuaJIT-2.1-20210510/src/lj_ccallback.c +-index 8d6cb737..80d738c6 100644 +---- a/LuaJIT-2.1-20210510/src/lj_ccallback.c +-+++ b/LuaJIT-2.1-20210510/src/lj_ccallback.c +-@@ -460,7 +460,7 @@ void lj_ccallback_mcode_free(CTState *cts) +- nfpr = CCALL_NARG_FPR; /* Prevent reordering. */ \ +- } \ +- } else { \ +-- if (!LJ_TARGET_IOS && n > 1) \ +-+ if (!LJ_TARGET_OSX && n > 1) \ +- ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \ +- if (ngpr + n <= maxgpr) { \ +- sp = &cts->cb.gpr[ngpr]; \ +--- +-2.34.1 +- +diff --git a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_02-arm64-fix-pcall-error-case.patch b/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_02-arm64-fix-pcall-error-case.patch +deleted file mode 100644 +index 9c35376..0000000 +--- a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_02-arm64-fix-pcall-error-case.patch ++++ /dev/null +@@ -1,29 +0,0 @@ +-From b4b2dce9fc3ffaaaede39b36d06415311e2aa516 Mon Sep 17 00:00:00 2001 +-From: Mike Pall +-Date: Wed, 27 Oct 2021 21:56:07 +0200 +-Subject: [PATCH] ARM64: Fix pcall() error case. +- +-Reported by Alex Orlenko. +---- +- src/vm_arm64.dasc | 3 ++- +- 1 file changed, 2 insertions(+), 1 deletion(-) +- +-diff --git a/LuaJIT-2.1-20210510/src/vm_arm64.dasc b/LuaJIT-2.1-20210510/src/vm_arm64.dasc +-index c7090ca3..eb87857f 100644 +---- a/LuaJIT-2.1-20210510/src/vm_arm64.dasc +-+++ b/LuaJIT-2.1-20210510/src/vm_arm64.dasc +-@@ -1163,9 +1163,10 @@ static void build_subroutines(BuildCtx *ctx) +- |//-- Base library: catch errors ---------------------------------------- +- | +- |.ffunc pcall +-+ | cmp NARGS8:RC, #8 +- | ldrb TMP0w, GL->hookmask +-- | subs NARGS8:RC, NARGS8:RC, #8 +- | blo ->fff_fallback +-+ | sub NARGS8:RC, NARGS8:RC, #8 +- | mov RB, BASE +- | add BASE, BASE, #16 +- | ubfx TMP0w, TMP0w, #HOOK_ACTIVE_SHIFT, #1 +--- +-2.34.1 +- +diff --git a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_03_patch_macro_luajit_version.patch b/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_03_patch_macro_luajit_version.patch +deleted file mode 100644 +index a5498c6..0000000 +--- a/openresty-patches/patches/1.19.9.1/LuaJIT-2.1-20210510_03_patch_macro_luajit_version.patch ++++ /dev/null +@@ -1,27 +0,0 @@ +-From f53c8fa441f4233b9a3f19fcd870207fe8795456 Mon Sep 17 00:00:00 2001 +-From: Qi +-Date: Wed, 25 May 2022 18:35:08 +0800 +-Subject: [PATCH] Patch macro `LUAJIT_VERSION` +- +---- +- src/luajit.h | 2 ++ +- 1 file changed, 2 insertions(+) +- +-diff --git a/LuaJIT-2.1-20210510/src/luajit.h b/LuaJIT-2.1-20210510/src/luajit.h +-index a4d33001..e35f4e7e 100644 +---- a/LuaJIT-2.1-20210510/src/luajit.h +-+++ b/LuaJIT-2.1-20210510/src/luajit.h +-@@ -32,7 +32,9 @@ +- +- #define OPENRESTY_LUAJIT +- +-+#ifndef LUAJIT_VERSION +- #define LUAJIT_VERSION "LuaJIT 2.1.0-beta3" +-+#endif +- #define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */ +- #define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta3 +- #define LUAJIT_COPYRIGHT "Copyright (C) 2005-2022 Mike Pall" +--- +-2.34.1 +- +- +diff --git a/test/kong_license.json b/test/kong_license.json +deleted file mode 120000 +index 0799913..0000000 +--- a/test/kong_license.json ++++ /dev/null +@@ -1 +0,0 @@ +-kong_license.private +\ No newline at end of file diff --git a/library/kong/kong-2.6.0-centos/0003.patch b/library/kong/kong-2.6.0-centos/0003.patch new file mode 100644 index 00000000..54a09696 --- /dev/null +++ b/library/kong/kong-2.6.0-centos/0003.patch @@ -0,0 +1,25 @@ +From c0048fd37274cc055b8fea2c08cd64c8d516fbc4 Mon Sep 17 00:00:00 2001 +From: yzewei +Date: Fri, 28 Jun 2024 17:25:30 +0800 +Subject: [PATCH] addl + +Signed-off-by: yzewei +--- + kong/meta.lua | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kong/meta.lua b/kong/meta.lua +index a3b8921..d9c18f0 100644 +--- a/kong/meta.lua ++++ b/kong/meta.lua +@@ -20,6 +20,6 @@ return { + -- third-party dependencies' required version, as they would be specified + -- to lua-version's `set()` in the form {from, to} + _DEPENDENCIES = { +- nginx = { "1.19.3.1", "1.19.9.1" }, ++ nginx = { "1.19.3.1", "1.25.3.1" }, + } + } +-- +2.38.1 + diff --git a/library/kong/kong-2.6.0-centos/Makefile b/library/kong/kong-2.6.0-centos/Makefile new file mode 100644 index 00000000..ea2df090 --- /dev/null +++ b/library/kong/kong-2.6.0-centos/Makefile @@ -0,0 +1,67 @@ +# This file is generated by the template. + +REGISTRY?=cr.loongnix.cn +ORGANIZATION?=library +REPOSITORY?=kong +TAG?=2.7.0-centos +LATEST?=true + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +# SOURCE_URL is a url to download source, such as https://github.com/merore/merore.git. +# SOURCE is project sources, its located at src/$(SORUCE). +# PATCH is a patch that supports loong64 to $(SOURCE). +# Be sure to fill in the follows!!! +DOCKER_KONG_SOURCE_URL=https://github.com/Kong/docker-kong.git +KONG_SOURCE_URL=https://github.com/Kong/kong.git +KONG_BUILD_TOOLS_SOURCE_URL=https://github.com/Kong/kong-build-tools.git +SOURCE=$(shell echo $(DOCKER_KONG_SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}') +PATCH_FOR_DOCKER_KONG=0001-port-to-loong64.patch +PATCH_FOR_KONG_BUILD_TOOLS=0002-port-to-loong64.patch +KONG_VERSION=2.6.0 +KONG_BUILD_TOOLS_VERSION=4.42.0 +IS_ROOT := $(shell id -u) +ifneq ($(IS_ROOT), 0) + SUDO=sudo +endif + +default: image + +image: kong-rpm +# Commands for building. + $(SUDO) $(MAKE) -C src/$(SOURCE) build + +kong-rpm: src/$(SOURCE) + $(SUDO) $(MAKE) -C src/kong-build-tools package-kong + @ls src/kong-build-tools/output + rm $