Created
November 24, 2016 14:32
-
-
Save yozik04/400b6bff8a98d1678a80fde6c8e102e9 to your computer and use it in GitHub Desktop.
PHP 7 fpm, alpine, mongodb and composer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7-fpm-alpine | |
RUN apk --update add --virtual build-dependencies build-base openssl-dev autoconf \ | |
&& pecl install mongodb \ | |
&& docker-php-ext-enable mongodb \ | |
&& apk del build-dependencies build-base openssl-dev autoconf \ | |
&& rm -rf /var/cache/apk/* | |
# Time Zone | |
RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini | |
# Register the COMPOSER_HOME environment variable | |
ENV COMPOSER_HOME /composer | |
# Add global binary directory to PATH and make sure to re-export it | |
ENV PATH /composer/vendor/bin:$PATH | |
# Allow Composer to be run as root | |
ENV COMPOSER_ALLOW_SUPERUSER 1 | |
# Setup the Composer installer | |
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \ | |
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ | |
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \ | |
&& php /tmp/composer-setup.php --install-dir=/usr/bin --filename=composer | |
# use composer this way: RUN composer require "mongodb/mongodb=^1.0.0" |
or try this
RUN apk update \
&& apk add --no-cache \
${PHPIZE_DEPS} \
&& pecl install mongodb \
&& docker-php-ext-enable \
mongodb \
&& apk del \
${PHPIZE_DEPS}
Many thanks !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing