Here is Dockerfile:
FROM php:7.1-fpm-alpine
MAINTAINER effio web studio <info@effio.org>
# Runtime dependencies
ENV PHPIZE_DEPS \
autoconf \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c
RUN set -xe \
&& apk add --no-cache bash bash-completion coreutils \
&& apk add --no-cache --virtual .persistent-deps \
freetype \
libjpeg-turbo \
libpng \
icu-libs \
libmcrypt \
libltdl \
libxml2 \
libpq \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
icu-dev \
libmcrypt-dev \
libxml2-dev \
mariadb-client-libs \
postgresql-dev \
&& docker-php-ext-install -j$(nproc) zip \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-configure bcmath \
&& docker-php-ext-install -j$(nproc) \
bcmath \
exif \
intl \
mcrypt \
pdo_mysql \
pdo_pgsql \
soap \
&& pecl channel-update pecl.php.net \
&& printf "\n" | pecl install apcu xdebug imagick \
&& apk del .build-deps
WORKDIR /app
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
And here is entrypoint.sh (which simply checks if there is PHP_ENABLE_XDEBUG environment variables, it enables xdebug:
#!/bin/bash
set -e
# If PHP_ENABLE_XDEBUG=1 xdebug extension will be enabled
[ -n "$PHP_ENABLE_XDEBUG" ] && docker-php-ext-enable xdebug
# Execute CMD
exec "$@"
But when passing PHP_ENABLE_XDEBUG variable to the container and running php --version in it, I get following error:
/usr/local/bin/docker-php-ext-enable: line 83: nm: not found
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
I think there's some lib dependency that is removed (purged) with my build dependencies.
Here is Dockerfile:
And here is entrypoint.sh (which simply checks if there is
PHP_ENABLE_XDEBUGenvironment variables, it enables xdebug:But when passing
PHP_ENABLE_XDEBUGvariable to the container and runningphp --versionin it, I get following error:I think there's some lib dependency that is removed (purged) with my build dependencies.