phpv8/v8js

libv8 must be version 9.0 or greater (using dockerfile)

mrgkoa opened this issue · 1 comments

mrgkoa commented

Is the dockerfile located here still working? https://github.com/stesie/docker-v8js/blob/master/Dockerfile I'm getting this issue
image

What branch of v8js should I use for this to work?

Other questions:

  1. What's the latest version of V8 engine supported by v8js
  2. What's the php version needed to run v8js

Thank you for this awesome module.

doug1n commented

An example using dockerfile

FROM stesie/libv8-10.5 AS builder
MAINTAINER Stefan Siegl <stesie@brokenpipe.de>

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    php-dev git ca-certificates g++ make

RUN git clone --branch php7 https://github.com/phpv8/v8js.git /usr/local/src/v8js
WORKDIR /usr/local/src/v8js

RUN phpize
RUN ./configure --with-v8js=/opt/libv8-10.5 LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
RUN make all -j`nproc`

FROM php:7.4-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    wget \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    zip \
    unzip \
    supervisor \
    libcurl4-openssl-dev \
    pkg-config \
    libssl-dev

COPY --from=builder "/usr/lib/x86_64-linux-gnu/libstdc++.so.*" /usr/lib/x86_64-linux-gnu/
COPY --from=builder /opt/libv8-10.5 /opt/libv8-10.5/

RUN apt-get -y install patchelf \
    && for A in /opt/libv8-10.5/lib/*.so; do patchelf --set-rpath '$ORIGIN' $A; done

COPY --from=builder /usr/local/src/v8js/modules/v8js.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/

RUN docker-php-ext-enable v8js

RUN pecl install mongodb \
    && docker-php-ext-enable mongodb

RUN pecl install redis \
    && docker-php-ext-enable redis

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:2.0.6 /usr/bin/composer /usr/bin/composer

ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
    && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
    && rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
    chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

ADD .docker/supervisord /etc/
COPY .docker/supervisord /etc/supervisor/conf.d/
ADD .docker/entrypoint.sh /entrypoint.sh
RUN chmod 0755 /entrypoint.sh

COPY .docker/php.ini /usr/local/etc/php/

# Install yacrontab
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
	python3 virtualenv
RUN virtualenv -p /usr/bin/python3 /yacron && \
	/yacron/bin/pip install yacron

COPY .docker/cron.yaml /etc/yacron.d/cron.yaml

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

USER $user

EXPOSE 9000

ENTRYPOINT ["/entrypoint.sh"]