From efdfe777599bc575c17937fe19565e58722ba7ee Mon Sep 17 00:00:00 2001 From: Robin Speekenbrink Date: Tue, 5 Jul 2016 22:38:12 +0200 Subject: [PATCH 1/2] tried to get the extension to work.. I've updated the raffle script (test.php) in order to dynamically read the given file, add the names. The problem is... all it currently does is return "yes" ? --- jaytaph-php7-extension/Dockerfile | 20 ++++++++++++++++++++ jaytaph-php7-extension/test.php | 14 +++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 jaytaph-php7-extension/Dockerfile diff --git a/jaytaph-php7-extension/Dockerfile b/jaytaph-php7-extension/Dockerfile new file mode 100644 index 0000000..1a1bc1b --- /dev/null +++ b/jaytaph-php7-extension/Dockerfile @@ -0,0 +1,20 @@ +FROM php:7-alpine +MAINTAINER robin@kingsquare.nl + +# build it and they will com.. pile +RUN apk add --no-cache autoconf g++ make + +# Create working dir +RUN mkdir -p /var/app +COPY . /var/app +WORKDIR /var/app + +# compile it and they will raffle +RUN phpize && \ + ./configure && \ + make && \ + make install && \ + echo "extension=domcode.so" >> /usr/local/etc/php/conf.d/domcode.ini + +CMD ["php", "test.php", "/var/names/current"] + diff --git a/jaytaph-php7-extension/test.php b/jaytaph-php7-extension/test.php index 0ba53a0..9ca2aec 100644 --- a/jaytaph-php7-extension/test.php +++ b/jaytaph-php7-extension/test.php @@ -1,8 +1,12 @@ addname('foo'); -$d->addname('bar'); -$d->addname('baz'); +$filename = !empty($argv[1]) && is_readable($argv[1]) ? realpath($argv[1]) : ''; +if (empty($filename)) { + die('please use `php test.php path_to_file`'); +} -echo $d->raffle(); +$d = new DomCode(); +foreach (array_filter(file($filename)) as $name) { + $d->addname($name); +} +echo $d->raffle().PHP_EOL; From 2bfbd4ccf4d054b69b47e3ed3dafc9c01c88232c Mon Sep 17 00:00:00 2001 From: Robin Speekenbrink Date: Tue, 5 Jul 2016 22:59:02 +0200 Subject: [PATCH 2/2] clean up after compiling --- jaytaph-php7-extension/Dockerfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/jaytaph-php7-extension/Dockerfile b/jaytaph-php7-extension/Dockerfile index 1a1bc1b..819fb33 100644 --- a/jaytaph-php7-extension/Dockerfile +++ b/jaytaph-php7-extension/Dockerfile @@ -1,20 +1,22 @@ FROM php:7-alpine MAINTAINER robin@kingsquare.nl -# build it and they will com.. pile -RUN apk add --no-cache autoconf g++ make - # Create working dir RUN mkdir -p /var/app COPY . /var/app WORKDIR /var/app -# compile it and they will raffle -RUN phpize && \ +RUN \ + apk add --no-cache autoconf g++ make &&\ + # build it and they will com.. pile + phpize && \ ./configure && \ + # compile it and they will raffle make && \ make install && \ - echo "extension=domcode.so" >> /usr/local/etc/php/conf.d/domcode.ini + echo "extension=domcode.so" >> /usr/local/etc/php/conf.d/domcode.ini && \ + # radio gaga... + apk del autoconf g++ make CMD ["php", "test.php", "/var/names/current"]