Skip to content

Instantly share code, notes, and snippets.

@dinamic
Last active April 8, 2024 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinamic/60a573e6ffa8749f94931a4d7cfcfcb8 to your computer and use it in GitHub Desktop.
Save dinamic/60a573e6ffa8749f94931a4d7cfcfcb8 to your computer and use it in GitHub Desktop.
FROM php:8.3-bookworm
RUN apt update -q \
&& apt upgrade -y \
&& apt-get install -y build-essential git libnode-dev
RUN mkdir -p /opt/v8 \
&& ln -s /usr/include/node /opt/v8/include \
&& ln -s /usr/lib/$(uname -m)-linux-gnu /opt/v8/lib
WORKDIR /tmp
RUN git clone https://github.com/phpv8/v8js.git
WORKDIR /tmp/v8js
RUN phpize \
&& ./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" \
&& make \
&& make test \
&& cp -v /tmp/v8js/modules/v8js.* `php -r "echo ini_get('extension_dir');"` \
&& docker-php-ext-enable v8js \
&& rm -rf /tmp/v8js
WORKDIR /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment