# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.4-base as builder ### ### Install ### RUN set -eux \ && DEBIAN_FRONTEND=noninteractive apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ libenchant-dev \ libevent-dev \ libfreetype6-dev \ libjpeg-dev \ libmemcached-dev \ libmysqlclient-dev \ libpng-dev \ libpq-dev \ libsasl2-dev \ libssl-dev \ libvpx-dev \ libwebp-dev \ libxpm-dev \ libzip-dev \ zlib1g-dev \ # Build tools autoconf \ bison \ bisonc++ \ ca-certificates \ curl \ dpkg-dev \ file \ flex \ g++ \ gcc \ git \ lemon \ libc-client-dev \ libc-dev \ libcurl4-openssl-dev \ libssl-dev \ make \ patch \ pkg-config \ re2c \ xz-utils \ && rm -rf /var/lib/apt/lists/* # Fix timezone (only required for testing to stop php -v and php-fpm -v from complaining to stderr) RUN set -eux \ && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini ### ### Install and enable PHP modules ### # Enable ffi if it exists RUN set -eux \ && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-ffi.ini ]; then \ echo "ffi.enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-ffi.ini; \ fi # -------------------- Installing PHP Extension: bcmath -------------------- RUN set -eux \ # Installation: Generic # Type: Built-in extension && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) bcmath \ && true # -------------------- Installing PHP Extension: enchant -------------------- RUN set -eux \ # Installation: Generic # Type: Built-in extension && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) enchant \ && true # -------------------- Installing PHP Extension: exif -------------------- RUN set -eux \ # Installation: Generic # Type: Built-in extension && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) exif \ && true # -------------------- Installing PHP Extension: gd -------------------- RUN set -eux \ # Version specific pre-command && ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libjpeg.* /usr/lib/ && \ ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libpng.* /usr/lib/ && \ ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libXpm.* /usr/lib/ && \ mkdir /usr/include/freetype2/freetype && \ ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h \ \ # Installation: Version specific # Type: Built-in extension # Custom: configure command && docker-php-ext-configure gd --with-gd --with-vpx-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf \ # Installation && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd \ && true # -------------------- Installing PHP Extension: igbinary -------------------- RUN set -eux \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install igbinary-2.0.8 \ # Enabling && docker-php-ext-enable igbinary \ && true # -------------------- Installing PHP Extension: msgpack -------------------- RUN set -eux \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install msgpack-0.5.7 \ # Enabling && docker-php-ext-enable msgpack \ && true # -------------------- Installing PHP Extension: memcached -------------------- RUN set -eux \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install memcached-2.2.0 \ # Enabling && docker-php-ext-enable memcached \ && true # -------------------- Installing PHP Extension: mongodb -------------------- RUN set -eux \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install mongodb-1.2.11 \ # Enabling && docker-php-ext-enable mongodb \ && true # -------------------- Installing PHP Extension: mysqli -------------------- RUN set -eux \ # Installation: Version specific # Type: Built-in extension # Installation && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) mysqli \ && true # -------------------- Installing PHP Extension: pgsql -------------------- RUN set -eux \ # Installation: Generic # Type: Built-in extension && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pgsql \ && true # -------------------- Installing PHP Extension: apcu -------------------- RUN set -eux \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install apcu-4.0.11 \ # Enabling && docker-php-ext-enable apcu \ && true # -------------------- Installing PHP Extension: redis -------------------- RUN set -eux \ # Generic pre-command && if [ -f /usr/include/liblzf/lzf.h ]; then \ ln -s /usr/include/liblzf/lzf.h /usr/include/; \ fi \ \ # Installation: Version specific # Type: PECL extension # Default: Pecl command && pecl install redis-4.3.0 \ # Enabling && docker-php-ext-enable redis \ && true # -------------------- Installing PHP Extension: zip -------------------- RUN set -eux \ # Installation: Version specific # Type: Built-in extension # Custom: configure command && docker-php-ext-configure zip --enable-zip --with-zlib-dir=/usr --with-pcre-dir=/usr \ # Installation && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) zip \ && true # Fix php.ini settings for enabled extensions RUN set -eux \ && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ && mkdir -p /usr/lib/oracle/ # Shrink everything down RUN set -eux \ && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.4-base as final MAINTAINER "cytopia" ### ### Labels ### # https://github.com/opencontainers/image-spec/blob/master/annotations.md #LABEL "org.opencontainers.image.created"="" #LABEL "org.opencontainers.image.version"="" #LABEL "org.opencontainers.image.revision"="" LABEL "maintainer"="cytopia " LABEL "org.opencontainers.image.authors"="cytopia " LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" LABEL "org.opencontainers.image.vendor"="devilbox" LABEL "org.opencontainers.image.licenses"="MIT" LABEL "org.opencontainers.image.ref.name"="5.4-mods" LABEL "org.opencontainers.image.title"="PHP-FPM 5.4-mods" LABEL "org.opencontainers.image.description"="PHP-FPM 5.4-mods" ### ### Install runtime libraries ### RUN set -eux \ && DEBIAN_FRONTEND=noninteractive apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ libenchant1c2a \ libevent-2.0-5 \ libfreetype6 \ libjpeg62-turbo \ libmemcachedutil2 \ libmysqlclient18 \ libpng12-0 \ libpq5 \ libvpx1 \ libwebp5 \ libxpm4 \ libzip2 \ zlib1g \ ca-certificates \ && rm -rf /var/lib/apt/lists/* \ \ && update-ca-certificates ### ### Copy artifacts from builder ### ARG EXT_DIR COPY --from=builder ${EXT_DIR}/ ${EXT_DIR}/ COPY --from=builder /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/ COPY --from=builder /usr/local/bin/ /usr/local/bin/ COPY --from=builder /usr/local/lib/ /usr/local/lib/ COPY --from=builder /usr/lib/oracle/ /usr/lib/oracle/ ### ### Post Install executions ### ### ### Verify ### RUN set -eux \ && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.4' \ && /usr/local/sbin/php-fpm --test \ \ && PHP_ERROR="$( php -v 2>&1 1>/dev/null )" \ && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ \ && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ && rm -f /usr/local/etc/php/php.ini \ \ && php -m | grep -oiE '^bcmath$' \ && php-fpm -m | grep -oiE '^bcmath$' \ && php -m | grep -oiE '^enchant$' \ && php-fpm -m | grep -oiE '^enchant$' \ && php -m | grep -oiE '^mbstring$' \ && php-fpm -m | grep -oiE '^mbstring$' \ && php -m | grep -oiE '^exif$' \ && php-fpm -m | grep -oiE '^exif$' \ && php -m | grep -oiE '^gd$' \ && php-fpm -m | grep -oiE '^gd$' \ && php -m | grep -oiE '^igbinary$' \ && php-fpm -m | grep -oiE '^igbinary$' \ && php -m | grep -oiE '^msgpack$' \ && php-fpm -m | grep -oiE '^msgpack$' \ && php -m | grep -oiE '^memcached$' \ && php-fpm -m | grep -oiE '^memcached$' \ && php -m | grep -oiE '^mongodb$' \ && php-fpm -m | grep -oiE '^mongodb$' \ && php -m | grep -oiE '^mysqli$' \ && php-fpm -m | grep -oiE '^mysqli$' \ && php -m | grep -oiE '^pgsql$' \ && php-fpm -m | grep -oiE '^pgsql$' \ && php -m | grep -oiE '^apcu$' \ && php-fpm -m | grep -oiE '^apcu$' \ && php -m | grep -oiE '^redis$' \ && php-fpm -m | grep -oiE '^redis$' \ && php -m | grep -oiE '^zip$' \ && php-fpm -m | grep -oiE '^zip$' \ && php -m | grep -oiE '^phar$' \ && php-fpm -m | grep -oiE '^phar$' \ && true # Deactive PSR and Phalcon: # https://github.com/devilbox/docker-php-fpm/issues/201 RUN set -eux \ && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ ### ### Ports ### EXPOSE 9000 ### ### Entrypoint ### CMD ["/usr/local/sbin/php-fpm"] ENTRYPOINT ["/docker-entrypoint.sh"]