-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enable xdebug in docker #2014
base: master
Are you sure you want to change the base?
Enable xdebug in docker #2014
Conversation
@@ -1,12 +1,9 @@ | |||
services: | |||
php: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this php-base
and still use php
instead of php-cli
?
@@ -32,3 +34,15 @@ RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2. | |||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |||
|
|||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | |||
|
|||
# Always copy a file, but choose# Always copy a file, but choose xdebug.ini or an empty one xdebug.ini or an empty one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a weird comment 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wonder why we need to copy the empty xdebug.ini
file if ENABLE_XDEBUG
would be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
- COPY cannot be used inside an if, so I have to write always write the config file
- But if the config is there when xdebug is not installed, PHP will give an error because it tries to load a module that does not exists
So solutions was to overwrite the config file with an empty one, in case of no xdebug activated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could remove the xdebug config file to solve the PHP error?
docker-compose --profile xdebug up | ||
``` | ||
|
||
You don't have to rebuild to switch, *you can just switch between versions in your docker engine*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you switch? Are both PHP containers running, one on port 8000 and one on port 8001 with xdebug enabled?
I wonder how this will behave on Jenkins, because as far as I know Jenkins uses our docker-compose file? |
container_name: php.uitdatabank | ||
extends: | ||
service: php | ||
profiles: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct, should this not always run? I think this breaks the existing setup when not using the xdebug profile
@@ -0,0 +1,2 @@ | |||
export XDEBUG_MODE=debug XDEBUG_SESSION=1 PHP_IDE_CONFIG="serverName=host.docker.internal" | |||
# https://github.com/cultuurnet/udb3-backend/pull/1425/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this doesn't have much added value?
Added
Another attempt to get Xdebug inside our docker setup, with an optional docker profile, so you can quickly switch between both versions.
All instructions can be found inside the readme file.
This is how it will look inside docker engine.
