Skip to content

Instantly share code, notes, and snippets.

@AlexMasterov
Last active January 12, 2017 14:24
Show Gist options
  • Save AlexMasterov/2fe3faa76e6fa28d19ecd93b99a49d96 to your computer and use it in GitHub Desktop.
Save AlexMasterov/2fe3faa76e6fa28d19ecd93b99a49d96 to your computer and use it in GitHub Desktop.
How to install PHP-JS on Alpine
# Template example
# [1] V8 libs (snapshot=on)
# https://github.com/AlexMasterov/dockerfiles/blob/master/alpine-v8-lib/Dockerfile
# -> https://www.dropbox.com/s/1hn1ak0iebuv9m4/alpine-v8-lib_5.5-lkgr.tar.gz
# [2] PHP
# https://github.com/AlexMasterov/dockerfiles/blob/master/alpine-php/Dockerfile
# php-js
PHPCPP_BRANCH="master" \
&& git clone -b ${PHPCPP_BRANCH} --depth 1 https://github.com/CopernicaMarketingSoftware/PHP-CPP.git /tmp/php-cpp \
&& cd /tmp/php-cpp \
&& make \
&& make install \
&& apk add --no-cache --virtual .phpjs-build-dependencies \
bc \
vim \
&& PHPJS_BRANCH="master" \
&& git clone -b ${PHPJS_BRANCH} --depth 1 https://github.com/CopernicaMarketingSoftware/PHP-JS.git /tmp/php-js \
&& cd /tmp/php-js \
&& UBUNTU_FAKE_VERSION="16" \
&& sed -ri "s/^?(UBUNTU_MAJOR\s*:=\s*).*$/\1${UBUNTU_FAKE_VERSION}/" Makefile \
&& cp /usr/local/v8/lib/*blob.bin . \
&& cp /usr/local/v8/lib/* /usr/lib \
&& cp -R /usr/local/v8/include/*.h /usr/include \
&& make \
&& cp -f php-js.so $(php-config --extension-dir) \
&& apk del .phpjs-build-dependencies \
# I don't know why they disappear after installation
&& cp /usr/local/v8/lib/* /usr/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment