lorisleiva / laravel-docker

🐳 Generic docker image for Laravel Applications
MIT License
934 stars 314 forks source link

Support Xdebug for code coverage reporting? #6

Closed ajcastro closed 6 years ago

zanematthew commented 6 years ago

It is odd, that he didn't add that, considering this line; - phpunit --coverage-text --colors=never , the --coverage-text doesn't work without Xdebug.

However, he does mention that its best to just copy his repo, and modify the Dockerfile to your liking.

FWIW, I'm currently experimenting this his build, noticed the above, and just made my own image and pushed it to Docker Hub; https://hub.docker.com/r/zanematthew/laravel-development/, as you can see by the docker file;

FROM php:alpine

# Install dev dependencies
RUN apk add --no-cache --virtual .build-deps \
    $PHPIZE_DEPS \
    curl-dev \
    imagemagick-dev \
    libtool \
    libxml2-dev \
    postgresql-dev \
    sqlite-dev

# Install production dependencies
RUN apk add --no-cache \
    bash \
    curl \
    g++ \
    gcc \
    git \
    imagemagick \
    libc-dev \
    libpng-dev \
    make \
    mysql-client \
    nodejs \
    nodejs-npm \
    openssh-client \
    postgresql-libs \
    rsync

# Install php extensions
RUN pecl install imagick \
    pecl install xdebug && docker-php-ext-enable xdebug
RUN pear install PHP_CodeSniffer
RUN docker-php-ext-enable imagick
RUN docker-php-ext-install \
    curl \
    iconv \
    mbstring \
    pdo \
    pdo_mysql \
    pdo_pgsql \
    pdo_sqlite \
    pcntl \
    tokenizer \
    xml \
    gd \
    zip

# Install composer
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="./vendor/bin:$PATH"

# Cleanup dev dependencies
RUN apk del -f .build-deps

# Setup working directory
WORKDIR /var/www

There are not many steps to; build, tag, and push your own image to Docker Hub, than to just use that.

zanematthew commented 6 years ago

@ajcastro FWIW I created a pull request, also happy riding, avid cyclist myself 👍

ajcastro commented 6 years ago

Wow nice.. Thanks alot @zanematthew.. It is cool to know you are a cyclist also :smiley:

lorisleiva commented 6 years ago

Hey guys 👋

Thanks for pointing this out. Indeed, I was planning to write a follow-up article using xdebug but forgot all about it.

xdebug should now be available by default.