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 Mar 31, 2024
1 parent 1161796 commit 6826fcd
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 1.39/apache/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.39/fpm-alpine/Dockerfile
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-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.39/fpm/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.40/apache/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.40/fpm-alpine/Dockerfile
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-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.40/fpm/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.41/apache/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.41/fpm-alpine/Dockerfile
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-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
3 changes: 3 additions & 0 deletions 1.41/fpm/Dockerfile
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-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
Expand All @@ -33,8 +34,10 @@ RUN set -eux; \
; \
\
pecl install APCu-5.1.21; \
pecl install LuaSandbox-4.1.2; \
docker-php-ext-enable \
apcu \
luasandbox \
; \
rm -r /tmp/pear; \
\
Expand Down
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-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.21"
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 6826fcd

Please sign in to comment.