View Issue Details

IDProjectCategoryView StatusLast Update
0001744XdebugInstallationpublic2021-03-17 09:31
ReporterMaks3w Assigned Toderick  
PrioritylowSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionwon't fix 
Summary0001744: Provide a dockerized version of XDebug
Description

I have a multistage docker build where the first image is the same as the production image and second image inherit from the first one and install development tools.

The issue is XDebug have to be frequently reinstalled after rebuild the container. This is because there is a COPY instruction on the production image which invalidate the rest of Docker cache layers.

The idea is XDebug to provide an official Docker container and use it in a multistage build. The benefits are:

  • Time reduction in compile (just download the image)
  • Easier to keep up to date with the latest versions
Steps To Reproduce

Production Dockerfile, imagine we tag it as 'acme/production'

FROM php:7.4

# Install production deps

COPY src ./

Development Dockerfile

FROM acme/production

ENV XDEBUG_CONFIG="remote_enable=on remote_host=host.docker.internal"

RUN pecl install xdebug \
    && docker-php-ext-enable xdebug

My current Improved Development Dockerfile

FROM php:7.4 as xdebug

RUN pecl install xdebug \
    && docker-php-ext-enable xdebug

FROM acme/production

ENV XDEBUG_CONFIG="remote_enable=on remote_host=host.docker.internal"

COPY --from=xdebug /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
COPY --from=xdebug /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
Additional Information

New Development Dockerfile using an official XDebug container

FROM acme/production

ENV XDEBUG_CONFIG="remote_enable=on remote_host=host.docker.internal"

COPY --from=xdebug:7.4 /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
COPY --from=xdebug:7.4 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
TagsNo tags attached.
Operating System
PHP Version7.4.0-7.4.4

Activities

derick

2021-03-17 09:31

administrator   ~0005753

At the moment, I have no interest in maintaining a Docker layer.

Issue History

Date Modified Username Field Change
2020-02-13 11:22 Maks3w New Issue
2020-03-12 16:23 derick Severity minor => feature
2020-03-12 16:24 derick Priority normal => low
2020-03-12 16:24 derick Category Feature/Change request => Installation
2021-03-17 09:31 derick Assigned To => derick
2021-03-17 09:31 derick Status new => resolved
2021-03-17 09:31 derick Resolution open => won't fix
2021-03-17 09:31 derick Note Added: 0005753