File tree 7 files changed +32
-32
lines changed
7 files changed +32
-32
lines changed Original file line number Diff line number Diff line change 1
1
.env
2
- symfony / composer_cache /**
2
+ composer_cache /**
Original file line number Diff line number Diff line change 14
14
15
15
### Running commands
16
16
17
- Symfony commands can be run using the symfony container, e.g.
17
+ Symfony commands can be run from the ** php ** container, e.g.
18
18
19
- ` docker-compose run symfony bin/console debug:router `
19
+ ```
20
+ docker-compose run php bin/console app:my_command
21
+ ```
20
22
21
- It will save time if you set up an alias within your shell for ` docker-compose run symfony bin/console ` .
23
+ It will save time if you set up an alias within your shell for ` docker-compose run php bin/console ` .
24
+
25
+ To enable xDebug step-debugging within commands, you need to set the * xdebug.remote_host* PHP directive - on the command line like so:
26
+
27
+ ```
28
+ docker-compose run php php -dxdebug.remote_host=192.168.1.2 bin/console app:my_command
29
+ ```
30
+
31
+ Replace * 192.168.1.2* with your ** host** machine's local network IP. I have a bash alias set up for running commands that does this automatically:
32
+
33
+ ```
34
+ alias dcrs="docker-compose run php php -dxdebug.remote_host=$(ip route get 192.168.1.1 | awk '{print $NF; exit}') bin/console"
35
+ ```
36
+
37
+ Replace * 192.168.1.1* with your local network's gateway, or * 8.8.8.8* .
22
38
23
39
### Using Composer
24
40
25
- Composer commands can be run within the symfony container:
41
+ Composer commands can be run within the ** php ** container:
26
42
27
- ` docker-compose run symfony composer *command* `
43
+ ` docker-compose run php composer *command* `
28
44
29
45
### Using other services
30
46
Original file line number Diff line number Diff line change @@ -7,16 +7,13 @@ services:
7
7
volumes :
8
8
- ${APP_PATH}:/var/www/symfony
9
9
working_dir : /var/www/symfony
10
- php-fpm :
10
+ php :
11
11
build : php-fpm
12
12
volumes :
13
13
- ${APP_PATH}:/var/www/symfony
14
- symfony :
15
- build : symfony
16
- user : " 1000"
17
- volumes :
18
- - ${APP_PATH}:/var/www/symfony
19
- - ./symfony/composer_cache:/var/www/.composer/cache
14
+ - ./composer_cache:/var/www/.composer/cache
15
+ environment :
16
+ - PHP_IDE_CONFIG=serverName=symfony.dev # Replace symfony.dev with the server name you've created in your IDE
20
17
mariadb :
21
18
image : mariadb:10.3
22
19
environment :
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ ADD symfony.conf /etc/nginx/sites-available/
11
11
RUN ln -s /etc/nginx/sites-available/symfony.conf /etc/nginx/sites-enabled/symfony
12
12
RUN rm /etc/nginx/sites-enabled/default
13
13
14
- RUN echo "upstream php-upstream { server php-fpm :9000; }" > /etc/nginx/conf.d/upstream.conf
14
+ RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
15
15
16
16
RUN usermod -u 1000 www-data
17
17
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ RUN echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebu
18
18
RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
19
19
RUN echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
20
20
RUN echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
21
- RUN echo "xdebug.remote_log='/var/log/xdebug_remote.log'" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
21
+
22
+ # install composer
23
+ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
22
24
23
25
RUN usermod -u 1000 www-data
26
+ USER 1000
27
+ WORKDIR /var/www/symfony
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments