-
-
Save limweb/b99cd4564f55516fe5e073f83b37f22e to your computer and use it in GitHub Desktop.
PHP 7 fpm, alpine, mongodb and composer
This file contains hidden or 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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment