From 9ab73144a0c282a9654aa949b7896809d0900918 Mon Sep 17 00:00:00 2001 From: fmadmin Date: Thu, 8 Mar 2018 16:03:59 +0000 Subject: [PATCH 1/4] Treeeeeeeeeees --- .drone.yml | 20 ++++++++++++ Dockerfile | 18 +++++++++++ composer.json | 2 +- composer.lock | 76 +++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 23 ++++++++++++++ index.php | 11 ++++++- 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 composer.lock create mode 100644 docker-compose.yaml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..8cfa155 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,20 @@ +# Declare a pipeline +pipeline: + # Declare pipeline step + composer-install: + # Use image for step + image: fpfis/php71-build + # Run commands from this image + commands: + - composer install --ansi + + # Declare another step + lint-code: + image: fpfis/php71-build + commands: + - php -l index.php + + run-code: + image: fpfis/php71-build + commands: + - php index.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..24a7a67 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ + +# Base image : +FROM fpfis/php56-build + +# Create a folder for my app in the container +RUN mkdir /app + +# Make the image work in this directory by default +WORKDIR /app + +# Push my local files to the image +ADD . /app + +# Run composer install to get my app ready +RUN composer install + +# Specify which command to run when my container starts +ENTRYPOINT [ "php", "/app/index.php" ] diff --git a/composer.json b/composer.json index e7ac977..00e7dd8 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { "require": { - "symfony/yaml" : "*", + "symfony/yaml" : "*" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..b5e2eed --- /dev/null +++ b/composer.lock @@ -0,0 +1,76 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "1d14b066a73960476c178ecf92bed18f", + "packages": [ + { + "name": "symfony/yaml", + "version": "v4.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "de5f125ea39de846b90b313b2cfb031a0152d223" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/de5f125ea39de846b90b313b2cfb031a0152d223", + "reference": "de5f125ea39de846b90b313b2cfb031a0152d223", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-02-19T20:08:53+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..3fb6119 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,23 @@ +version: '2' +services: + + # Define a PHP webserver + php-webserver: + # Use a PHP image with apache + image: fpfis/php56-dev + # Define settings + environment: + - XDEBUG=true + - DOCUMENT_ROOT=/app/build + # Mount a local volume in the container + volumes: + - ./:/app/build + # Share the container port with the host + ports: + - 8080:8080 + + # Define a mysql service + mysql: + image: fpfis/mysql56 + + diff --git a/index.php b/index.php index 03efc33..7240df3 100644 --- a/index.php +++ b/index.php @@ -7,7 +7,16 @@ $array = array( 'foo' => 'bar', - 'bar' => array('foo' => 'bar', 'bar' => 'baz' => 'test'), + 'bar' => array('foo' => 'bar', 'bar' => 'baz'), ); echo Yaml::dump($array); +$a=0; +$tree='*'; +while (1) { + for ($a; $a>0; $a--){ + $tree = $tree.'*'; + } + print($tree."\n"); + $a++; +} From 5ccfa8e90b2448b37f20a7ee46f5d8ee8cb616a4 Mon Sep 17 00:00:00 2001 From: fmadmin Date: Thu, 8 Mar 2018 16:12:53 +0000 Subject: [PATCH 2/4] Treeeeeeeeeees 2 --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index 7240df3..99fba92 100644 --- a/index.php +++ b/index.php @@ -13,10 +13,14 @@ echo Yaml::dump($array); $a=0; $tree='*'; +$start_time = time(); while (1) { for ($a; $a>0; $a--){ $tree = $tree.'*'; } print($tree."\n"); $a++; + if ((time() - $start_time) > 900) { + return false; // timeout, function took longer than 300 seconds + } } From 546103f73e3fc24882e35a51e66240990b1229af Mon Sep 17 00:00:00 2001 From: fmadmin Date: Thu, 8 Mar 2018 16:17:42 +0000 Subject: [PATCH 3/4] Treeeeeeeeeees 3 --- index.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 99fba92..e451357 100644 --- a/index.php +++ b/index.php @@ -11,16 +11,17 @@ ); echo Yaml::dump($array); -$a=0; $tree='*'; $start_time = time(); while (1) { - for ($a; $a>0; $a--){ - $tree = $tree.'*'; - } + $tree = $tree.'*'; print($tree."\n"); $a++; - if ((time() - $start_time) > 900) { + if ($a > 10){ + $a = 1; + $tree = '*'; + } + if ((time() - $start_time) > 1) { return false; // timeout, function took longer than 300 seconds } } From 002bacacb260b127ed3f52c7bcf309654f516043 Mon Sep 17 00:00:00 2001 From: fmadmin Date: Thu, 8 Mar 2018 16:18:13 +0000 Subject: [PATCH 4/4] Treeeeeeeeeees 3 --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index e451357..da36340 100644 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ $a = 1; $tree = '*'; } - if ((time() - $start_time) > 1) { + if ((time() - $start_time) > 600) { return false; // timeout, function took longer than 300 seconds } }