From daa6ea8f9ce4a07b7210a229e337d98cd4e68d1a Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 2 Aug 2022 11:15:21 +0200 Subject: [PATCH] fixed some issues, added xdebug --- Dockerfile | 13 +++++++++++++ README.md | 16 ++++++++++++++++ docker-compose.yml | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 10d5a0b..914166c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,19 @@ RUN apt-get install -y \ RUN apt-get install -y git zip +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug \ + && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.client_host = host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo 'xdebug.discover_client_host=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo 'xdebug.log=/var/www/var/log/xdebug.log' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo 'xdebug.log_level=0' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +# && echo 'xdebug.client_port=9003' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ +# && echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ +# && echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ +# && echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + COPY .docker/contao/install_composer.sh /install_composer.sh RUN chmod +x /install_composer.sh \ diff --git a/README.md b/README.md index c5e2de2..e99c177 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,23 @@ - NOTE: the 'host' isn't 'localhost' here, use the name of the database service 'database' as it's configured in the docker-compose.yml - Finish the installation and have fun :) + - NOTE: For full installation you have to wait until composer is fully done with installation if you install + the project for the first time (or setting it up freshly). If you use Docker Desktop you can go to "Containers" + and click on the container named "contao". Then you'll see the console output of this container and wait until it's + done to ensure the project is running properly. - Contao will be available here: [http://localhost/contao](http://localhost/contao) +- XDebug: + - Xdebug is also available within this project. If you'd like to use it do the following in PHPStorm: + 1. Go to Preferences->PHP + 2. Click on "..."-button at CLI Interpreter + 3. A new window for CLI Interpreters will pop up + 4. Click on "+" in order to add a new CLI interpreter + 5. Select "From Docker, Vagrant, VM, WSL, Remote..." + 6. A new window will pop up and select radiobutton "Docker" (should be selected by default) here and then select + the docker image, which is "php-apache-contao:latest" in this case + 7. After selection the PHP version will be displayed and also the XDebug version + 8. Actually you're done, but you should set the "PHP language level" on the first screen on the same PHP Version + as your CLI Interpreter to make sure that PHPStorm helps you with your very PHP version :) # Some important information - The database content is stored in a container which is bind-mounted to the 'db'-folder of the project diff --git a/docker-compose.yml b/docker-compose.yml index f6d521d..f99b1bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,12 +9,13 @@ services: environment: MYSQL_ROOT_PASSWORD: root volumes: - - ./../.db:/var/lib/mysql + - ./.db:/var/lib/mysql networks: - default contao: build: dockerfile: ./Dockerfile + image: php-apache-contao container_name: contao ports: - "80:80"