Skip to content

Commit

Permalink
Install LuaSandbox PECL extension in containers
Browse files Browse the repository at this point in the history
Scribunto ships with a statically linked lua5.1 binary, but it doesn't
work on alpine because of the glibc dependency.

We can install the LuaSandbox PECL extension to fix the situation for
alpine users and give everyone else a performance boost.

Bug: T285882
  • Loading branch information
legoktm committed Aug 18, 2024
1 parent b3b4ecd commit 259a0d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
lua5.1-dev \
oniguruma-dev \
; \
\
Expand All @@ -28,8 +29,10 @@ RUN set -eux; \
; \
\
pecl install APCu-%%APCU_VERSION%%; \
pecl install LuaSandbox-%%LUASANDBOX_VERSION%%; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile-debian.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN set -eux; \
apt-get install -y --no-install-recommends \
libicu-dev \
libonig-dev \
liblua5.1-0-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-%%APCU_VERSION%%; \
pecl install LuaSandbox-%%LUASANDBOX_VERSION%%; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
2 changes: 2 additions & 0 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"default": "8.1",
}
APCU_VERSION = "5.1.23"
LUASANDBOX_VERSION = "4.1.2"
VARIANTS = ["apache", "fpm", "fpm-alpine"]
ROOT_DIR = Path(__file__).parent

Expand Down Expand Up @@ -91,6 +92,7 @@ def main():
.replace("%%MEDIAWIKI_VERSION%%", latest)
.replace("%%VARIANT%%", variant)
.replace("%%APCU_VERSION%%", APCU_VERSION)
.replace("%%LUASANDBOX_VERSION%%", LUASANDBOX_VERSION)
.replace(
"%%CMD%%",
"apache2-foreground" if variant == "apache" else "php-fpm",
Expand Down

0 comments on commit 259a0d8

Please sign in to comment.