Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .docker/nginx/browser.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
resolver 127.0.0.11; # Docker's embedded DNS server

map $cookie_XDEBUG_SESSION $fastcgi_pass {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this needs to set something specific in the IDE/host, it would need documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work with any value.

default app;
~.+ app-debug;
}

server {
server_name localhost;
listen 80;
Expand All @@ -14,7 +21,8 @@ server {
include fastcgi_params;
internal;

fastcgi_pass app:9000;
fastcgi_pass $fastcgi_pass:9000;
fastcgi_read_timeout 1d; # For Xdebug
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like variables can't be set with time values.

fastcgi_split_path_info ^(.+\.php)(/.*)$;

fastcgi_param SCRIPT_FILENAME /app/public/$fastcgi_script_name;
Expand Down
3 changes: 3 additions & 0 deletions .docker/php-debug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
xdebug.remote_enable = 1
xdebug.remote_host = host.docker.internal
xdebug.remote_port = 9000
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,22 @@ COPY .docker/php-dev.ini ${PHP_INI_DIR}/conf.d/01-app.ini

RUN bin/console assets:install && \
rm -rf var/*



#
# Stage: Debug environment
#
FROM dev AS debug

RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
pecl install \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like compiling things for a dynamic language, but no alternative

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did wonder if the compilation could be done separately and the result copied in to save app changes from re-running it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory the end result is just a .so file in the right place, which if the PHP (and OS?) version match should be movable across filesystems. Maintaining the code to move it around might not be worth it though if the primary use case of dev is overriding the code with a host folder mounted as a volume.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will ignore for now, can revisit if it does become annoying.

xdebug-2.7.0 \
&& \
docker-php-ext-enable \
xdebug \
&& \
apk del .build-deps && \
rm -rf /var/cache/apk/

COPY .docker/php-debug.ini ${PHP_INI_DIR}/conf.d/02-app.ini
19 changes: 19 additions & 0 deletions docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,22 @@ services:
- ./:/app
- /app/var
- /app/vendor
app-debug:
build:
context: .
target: debug
environment:
API_URI: http://web:8080
APP_SECRET:
DEFAULT_LOCALE: ${DEFAULT_LOCALE:-en}
volumes:
- ./:/app
- /app/var
- /app/vendor
depends_on:
- api
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately extends was removed from Docker Compose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is basically a copy of app with a derived image, which lives only locally. Fair.

web:
depends_on:
- api
- app
- app-debug