Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions jaytaph-php7-extension/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM php:7-alpine
MAINTAINER robin@kingsquare.nl

# Create working dir
RUN mkdir -p /var/app
COPY . /var/app
WORKDIR /var/app

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 && \
# radio gaga...
apk del autoconf g++ make

CMD ["php", "test.php", "/var/names/current"]

14 changes: 9 additions & 5 deletions jaytaph-php7-extension/test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

$d = new DomCode();
$d->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;