brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.16k stars 365 forks source link

xdebug for php runtimes #1162

Open anto-acube opened 2 years ago

anto-acube commented 2 years ago

Hello, why is xdebug enabled only for fpm runtimes? It would be great to have it on php runtimes too, to debug easily complex event-driven functions

mnapoli commented 2 years ago

If I recall correctly we needed a "fpm-dev" image (to work locally) so we had the opportunity to add xdebug in there (without impacting the "real" images).

We don't have such an image for "function", so that's at least why we are in this situation.

deleugpn commented 2 years ago

You can work around this by building your own local image and copying the xdebug extension

FROM bref/php-81:1.5.3

COPY --from=bref/extra-redis-php-81:0.11 /opt/bref-extra /opt/bref-extra

COPY --from=bref/extra-xdebug-php-81:0.11 /opt/bref-extra /opt/bref-extra
COPY --from=bref/extra-xdebug-php-81:0.11 /opt/bref/ /opt/bref

COPY --from=bref/extra-gmp-php-81:0.11 /opt/bref-extra /opt/bref-extra
COPY --from=bref/extra-gmp-php-81:0.11 /opt/bref/ /opt/bref

When you build this image it's almost as if you were including the xdebug layer onto your local image. You would then need to mount your source code as volume into your image.