File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ services:
52
52
args :
53
53
UID : ${UID}
54
54
GID : ${GID}
55
+ XDEBUG_ENABLED : ${XDEBUG_ENABLED}
56
+ XDEBUG_MODE : ${XDEBUG_MODE}
57
+ XDEBUG_HOST : ${XDEBUG_HOST}
58
+ XDEBUG_IDE_KEY : ${XDEBUG_IDE_KEY}
59
+ XDEBUG_LOG : ${XDEBUG_LOG}
60
+ XDEBUG_LOG_LEVEL : ${XDEBUG_LOG_LEVEL}
55
61
tty : true # Enables an interactive terminal
56
62
stdin_open : true # Keeps standard input open for 'docker exec'
57
63
env_file :
Original file line number Diff line number Diff line change @@ -31,6 +31,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
31
31
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
32
32
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
33
33
34
+ # Use ARG to define environment variables passed from the Docker build command or Docker Compose.
35
+ ARG XDEBUG_ENABLED
36
+ ARG XDEBUG_MODE
37
+ ARG XDEBUG_HOST
38
+ ARG XDEBUG_IDE_KEY
39
+ ARG XDEBUG_LOG
40
+ ARG XDEBUG_LOG_LEVEL
41
+
42
+ # Configure Xdebug if enabled
43
+ RUN if [ "${XDEBUG_ENABLED}" = "true" ]; then \
44
+ docker-php-ext-enable xdebug && \
45
+ echo "xdebug.mode=${XDEBUG_MODE}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
46
+ echo "xdebug.idekey=${XDEBUG_IDE_KEY}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
47
+ echo "xdebug.log=${XDEBUG_LOG}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
48
+ echo "xdebug.log_level=${XDEBUG_LOG_LEVEL}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
49
+ echo "xdebug.client_host=${XDEBUG_HOST}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ; \
50
+ echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ; \
51
+ fi
52
+
34
53
# If the group already exists, use it; otherwise, create the 'www' group
35
54
RUN if getent group ${GID}; then \
36
55
useradd -m -u ${UID} -g ${GID} -s /bin/bash www; \
You can’t perform that action at this time.
0 commit comments