Skip to content

Commit

Permalink
fixes for xdebug in cli container
Browse files Browse the repository at this point in the history
  • Loading branch information
rw4lll committed Oct 13, 2024
1 parent b3dd42a commit 5c1f21c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions development/nginx-fpm/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ services:
args:
UID: ${UID}
GID: ${GID}
XDEBUG_ENABLED: ${XDEBUG_ENABLED}
XDEBUG_MODE: ${XDEBUG_MODE}
XDEBUG_HOST: ${XDEBUG_HOST}
XDEBUG_IDE_KEY: ${XDEBUG_IDE_KEY}
XDEBUG_LOG: ${XDEBUG_LOG}
XDEBUG_LOG_LEVEL: ${XDEBUG_LOG_LEVEL}
tty: true # Enables an interactive terminal
stdin_open: true # Keeps standard input open for 'docker exec'
env_file:
Expand Down
19 changes: 19 additions & 0 deletions development/nginx-fpm/workspace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Use ARG to define environment variables passed from the Docker build command or Docker Compose.
ARG XDEBUG_ENABLED
ARG XDEBUG_MODE
ARG XDEBUG_HOST
ARG XDEBUG_IDE_KEY
ARG XDEBUG_LOG
ARG XDEBUG_LOG_LEVEL

# Configure Xdebug if enabled
RUN if [ "${XDEBUG_ENABLED}" = "true" ]; then \
docker-php-ext-enable xdebug && \
echo "xdebug.mode=${XDEBUG_MODE}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.idekey=${XDEBUG_IDE_KEY}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.log=${XDEBUG_LOG}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.log_level=${XDEBUG_LOG_LEVEL}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.client_host=${XDEBUG_HOST}" >> /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 ; \
fi

# If the group already exists, use it; otherwise, create the 'www' group
RUN if getent group ${GID}; then \
useradd -m -u ${UID} -g ${GID} -s /bin/bash www; \
Expand Down

0 comments on commit 5c1f21c

Please sign in to comment.