diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a3e806c4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +.styleci.yml +.travis.yml +.editorconfig +.gitattributes +.editorconfig +.all-contributorsrc +phpunit.xml.dist +CHANGELOG.md +CONTRIBUTING.md +LICENSE.md +README.md +/docker +/docs diff --git a/README.md b/README.md index 995aa2b3..11c08a7f 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,13 @@ You may customize `insights` creating and editing the configuration file: cp vendor/nunomaduro/phpinsights/stubs/config.php phpinsights.php ``` +### With Docker + +You can also use `phpinsights` via Docker: +```bash +docker run -it --rm -v /path/to/app:/app nunomaduro/phpinsights +``` + ### Continuous Integration You can run PHP Insights in your CI by defining level you want to reach with the options `--min-quality`, `--min-complexity`, `--min-architecture`, `--min-style`. @@ -95,6 +102,7 @@ php artisan insights --no-interaction --min-quality=80 --min-complexity=90 --min All others are optional, so if you want to focus only on style, add the `--min-style` and forget others. + ### Display issues omitted PHP Insights console command have different verbosity levels, which determine the quantity of issues displayed. By default, commands display only the 3 first issues per `Insight`, but you can display them all with the `-v` option: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..d30d6d02 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,26 @@ +FROM php:7.3-cli-alpine + +ENV COMPOSER_ALLOW_SUPERUSER=1 + +COPY --from=composer:1.8 /usr/bin/composer /usr/bin/composer + +COPY . /phpinsights + +RUN apk add --no-cache --update git \ + \ + && composer install -d /phpinsights \ + --no-dev \ + --no-ansi \ + --no-interaction \ + --no-scripts \ + --no-suggest \ + --no-progress \ + --prefer-dist \ + \ + && echo 'memory_limit = -1' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini \ + \ + && ln -sfv /phpinsights/bin/phpinsights /usr/bin/phpinsights + +WORKDIR /app + +ENTRYPOINT ["phpinsights"]