Skip to content

Instantly share code, notes, and snippets.

@dinamic
Last active August 5, 2025 10:22
Show Gist options
  • Save dinamic/60a573e6ffa8749f94931a4d7cfcfcb8 to your computer and use it in GitHub Desktop.
Save dinamic/60a573e6ffa8749f94931a4d7cfcfcb8 to your computer and use it in GitHub Desktop.

Revisions

  1. dinamic revised this gist Jun 10, 2024. 1 changed file with 10 additions and 12 deletions.
    22 changes: 10 additions & 12 deletions php-v8js.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,21 @@
    FROM php:8.3-bookworm

    RUN apt update -q \
    && apt upgrade -y \
    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
    RUN cp -s /usr/lib/`uname -m`-linux-gnu/libv8* /usr/local/lib/ \
    && cp -rs /usr/include/node/* /usr/local/include/

    # TODO: Use PECL

    WORKDIR /tmp
    RUN git clone https://github.com/phpv8/v8js.git
    RUN git clone https://github.com/phpv8/v8js.git --branch php8

    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');"` \
    RUN phpize && ./configure && make && make test \
    && cp -v modules/v8js.* `php -r "echo ini_get('extension_dir');"` \
    && docker-php-ext-enable v8js \
    && rm -rf /tmp/v8js
    && rm -rf /tmp/v8js \
    && php --ri v8js

    WORKDIR /var/www/html
  2. dinamic revised this gist Apr 8, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php-v8js.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ FROM php:8.3-bookworm

    RUN apt update -q \
    && apt upgrade -y \
    && apt-get install -y build-essential curl git python3 libglib2.0-dev ninja-build clang procps libnode-dev
    && apt-get install -y build-essential git libnode-dev

    RUN mkdir -p /opt/v8 \
    && ln -s /usr/include/node /opt/v8/include \
  3. dinamic revised this gist Apr 8, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php-v8js.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ RUN apt update -q \

    RUN mkdir -p /opt/v8 \
    && ln -s /usr/include/node /opt/v8/include \
    && ln -s /usr/lib/x86_64-linux-gnu /opt/v8/lib
    && ln -s /usr/lib/$(uname -m)-linux-gnu /opt/v8/lib

    WORKDIR /tmp
    RUN git clone https://github.com/phpv8/v8js.git
  4. dinamic renamed this gist Apr 5, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. dinamic renamed this gist Apr 5, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. dinamic created this gist Apr 5, 2024.
    23 changes: 23 additions & 0 deletions PHP V8JS Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    FROM php:8.3-bookworm

    RUN apt update -q \
    && apt upgrade -y \
    && apt-get install -y build-essential curl git python3 libglib2.0-dev ninja-build clang procps libnode-dev

    RUN mkdir -p /opt/v8 \
    && ln -s /usr/include/node /opt/v8/include \
    && ln -s /usr/lib/x86_64-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