Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (31 sloc)
1.31 KB
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.4-cli-alpine | |
# Install (and cleanup) basic packages | |
RUN apk update \ | |
&& apk add --no-cache --virtual .mongodb-ext-build-deps autoconf \ | |
build-base openssl-dev pcre-dev bash \ | |
&& docker-php-ext-install pdo_mysql mysqli sockets \ | |
&& docker-php-ext-install bcmath \ | |
&& docker-php-ext-install pcntl && docker-php-ext-enable pcntl \ | |
&& pecl install mongodb && docker-php-ext-enable mongodb \ | |
&& docker-php-ext-enable pcntl \ | |
&& docker-php-source delete \ | |
&& apk del .mongodb-ext-build-deps autoconf build-base \ | |
&& rm -rf /var/cache/apk/* | |
# Use PHP INI production file by default | |
# You can use a dev or custom version on child images | |
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini | |
# Install Composer to shared location | |
RUN curl -sS https://getcomposer.org/installer | php \ | |
&& mv composer.phar /usr/local/bin/ \ | |
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer | |
# Add unprivileged user | |
RUN addgroup phpuser -g 1001 | |
RUN adduser -S -u 1001 -G phpuser -h /home/phpuser -s /bin/bash phpuser | |
RUN mkdir -p /home/phpuser/.composer/cache /home/phpuser/.ssh | |
RUN touch /home/phpuser/.ssh/known_hosts | |
RUN chown -R phpuser:phpuser /home/phpuser | |
# Use unprivileged user from now on | |
USER phpuser | |
ENV HOME /home/phpuser | |
WORKDIR $HOME | |
CMD ["php", "-v"] |