View Issue Details

IDProjectCategoryView StatusLast Update
0001744XdebugInstallationpublic2020-03-12 16:24
ReporterMaks3wAssigned To 
PrioritylowSeverityfeatureReproducibilityhave not tried
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0001744: Provide a dockerized version of XDebug
DescriptionI 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 ReproduceProduction 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 InformationNew 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

There are no notes attached to this issue.

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