Shell script to determine compatible xDebug versions for a given PHP version.
1.1K
Shell script to determine compatible xDebug versions for a given PHP version.
Different versions of PHP require specific xDebug versions for compatibility.
When building PHP Docker images, it can be annoying to find the correct version. That is where this script comes in.
The script is available from potherca/xdebug-version on GitHub.
The script can be used in a Dockerfile, either by using the downloaded version or directly from DockerHub:
ARG PHP_VERSION
# ==============================================================================
FROM php:${PHP_VERSION}-alpine AS builder
# ------------------------------------------------------------------------------
ARG PHP_VERSION
ARG XDEBUG_VERSION
WORKDIR /app
COPY --from=potherca/xdebug-version:v0.2.0 xdebug-version.sh /xdebug-version.sh
RUN sh /xdebug-version.sh > /xdebug.version
# ==============================================================================
# ==============================================================================
FROM php:${PHP_VERSION}-alpine
# ------------------------------------------------------------------------------
# Copy Xdebug version information from builder stage
COPY --from=builder /xdebug.version /xdebug.version
# Install dependencies and extensions
RUN apk add --no-cache --update \
${PHPIZE_DEPS} \
&& pecl install "xdebug-$(cat /xdebug.version)" \
&& docker-php-ext-enable xdebug
Content type
Image
Digest
sha256:001c077cd…
Size
589 Bytes
Last updated
7 months ago
docker pull potherca/xdebug-version