diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..43c3f21 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +FROM markizano/devuan:beowulf-amd64 + +RUN apt-get update +RUN apt-get install -y php-cli git unzip php-xml + +COPY get_composer.sh /root/ +RUN bash /root/get_composer.sh && rm /root/get_composer.sh + +RUN mkdir /app +WORKDIR /app +RUN composer init && composer config repositories.jhodges composer https://composer.jhodges.co.uk && composer require jhodges/sitemap + +COPY crawl.php /app/ + +RUN apt clean + +ENTRYPOINT php crawl.php diff --git a/docker/crawl.php b/docker/crawl.php new file mode 100644 index 0000000..6344614 --- /dev/null +++ b/docker/crawl.php @@ -0,0 +1,18 @@ +crawl($url); + +foreach($crawler->getResults() as $url=>$result){ + echo("{$result['code']} {$url}\n"); + foreach($result['foundOn'] as $url=>$count){ + echo(" <- ($count) $url\n"); + } +} diff --git a/docker/get_composer.sh b/docker/get_composer.sh new file mode 100644 index 0000000..b05f431 --- /dev/null +++ b/docker/get_composer.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + +if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] +then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 +fi + +php composer-setup.php --1 --filename=composer --install-dir=/usr/local/bin +RESULT=$? +rm composer-setup.php +exit $RESULT