-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add phpq (MacFJA/phpqa-extensions) extensions to docker image or bin/suggested-tools.sh #168
Comments
Well, it's not that simple. Even when I add new tools, somebody will need different versions (#159 (comment)), different php versions etc. I recommend building custom docker image. Take a look at troubleshooting in composer docker image. |
Ok, thank you - closing for now |
Custom docker image example1. Build an imageAdd necessary php extensions, composer, phpqa... FROM php:7.0-cli-alpine
RUN apk update \
&& apk add zlib-dev postgresql-libs postgresql-dev postgresql-client libxml2-dev libxslt-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-install pdo pdo_pgsql pgsql zip opcache xml soap mbstring xsl \
&& apk del postgresql-dev
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin/ --filename=composer
RUN composer global require edgedesign/phpqa --update-no-dev \
&& ln -s /root/.composer/vendor/bin/phpqa /usr/local/bin/
CMD sh -c "php -v && php -m | xargs && phpqa tools" Build an image, test it before pushing to a Container Registry. # test local image
docker build --file Dockefile --tag registry.gitlab.com/my_project/php7_ci/master:20190507 app/.docker
docker run --rm -it registry.gitlab.com/my_project/php7_ci/master:20190507
docker run --rm -it registry.gitlab.com/my_project/php7_ci/master:20190507 sh 2. Gitlab CIYou can use an image from a private Container Registry. stages:
- test
test:
stage: test
# it works because of CI_REGISTRY_PASSWORD and CI_REGISTRY_USER, secret variable DOCKER_AUTH_CONFIG is not necessary`
image: registry.gitlab.com/my_project/php7_ci/master:20190507
variables:
BACKEND_QA: "*/backend/var/QA"
BACKEND_CACHE: $CI_PROJECT_DIR/.composercache
cache:
paths:
- $BACKEND_CACHE
script:
- 'export COMPOSER_CACHE_DIR=$BACKEND_CACHE'
- 'composer install --no-progress --no-suggest'
- 'phpqa --report --tools phpcs:0,phpunit:0 --buildDir var/QA --analyzedDirs ./ --ignoredDirs var,vendor'
artifacts:
when: always
paths:
- $BACKEND_QA
|
Using the docker image in Gitlab is a breeze.
Sadly some of the tools are not useable due to the limitations you have in the
bin/suggested-tools.sh
, I suggest, that you include the plugins in the docker image.Thank you for taking care.
PS: Otherwise it would be nice to cherry-pick the related analyzers into
phpqa
itself.The text was updated successfully, but these errors were encountered: