diff --git a/Dockerfile b/Dockerfile index 2a3e7da..3c9d49b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,53 +1,23 @@ -FROM php:alpine +ARG PHP_VERSION=8.0 -ENV COMPOSER_ALLOW_SUPERUSER=1 \ - PATH="./vendor/bin:$PATH" +FROM php:$PHP_VERSION-alpine RUN apk add --update --no-cache \ - bash \ - openssh-client \ - rsync + bash npm openssh-client rsync -RUN apk add --update --no-cache -t .persistent-deps \ - # for bz2 extension - bzip2-dev \ - # for gd --with-freetype-dir option - freetype-dev \ - # for gmp extension - gmp-dev \ - # for gd --with-jpeg-dir option - libjpeg-turbo-dev \ - # for gd --with-png-dir option - libpng-dev \ - # for zip extension - libzip-dev \ - # Environment - && set -xe \ - # Configure - && docker-php-ext-configure gd \ - --with-freetype-dir=/usr/include \ - --with-jpeg-dir=/usr/include \ - --with-png-dir=/usr/include \ - && docker-php-ext-configure zip \ - --with-libzip \ - && docker-php-ext-install \ - bcmath \ - bz2 \ - exif \ - gd \ - gmp \ - pdo_mysql \ - zip \ - # Composer - && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin --filename=composer \ - # Cleanup - && apk del --no-cache \ - freetype-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - && rm -rf \ - /tmp/* \ - /var/cache/apk/* \ - /var/tmp/* +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ + +RUN chmod +x /usr/local/bin/install-php-extensions && \ + install-php-extensions \ + @composer \ + bcmath-$PHP_VERSION \ + bz2-$PHP_VERSION \ + exif-$PHP_VERSION \ + gd-$PHP_VERSION \ + gmp-$PHP_VERSION \ + pdo_mysql-$PHP_VERSION \ + zip-$PHP_VERSION + +RUN rm -rf /tmp/* /var/cache/apk/* /var/tmp/* WORKDIR /var/www