diff --git a/examples/laravel/Dockerfile b/examples/laravel/Dockerfile index 5646e6c..98f75ed 100644 --- a/examples/laravel/Dockerfile +++ b/examples/laravel/Dockerfile @@ -1,10 +1,12 @@ -FROM php:7.4 +FROM php:7.4-fpm # System dependencies needed RUN apt-get update && apt-get install -y \ git \ vim \ openssl \ + zip \ + libzip-dev \ curl \ wget \ gnupg \ @@ -20,10 +22,10 @@ RUN apt-get update && apt-get install -y \ libfontconfig && rm -rf /var/lib/apt/lists/* # PHP Extensions needed for Laravel -RUN docker-php-ext-install calendar zip intl mbstring pdo_mysql bcmath opcache pdo +RUN docker-php-ext-install calendar zip intl pdo_mysql bcmath opcache pdo # Per project extensions needed for specific project -RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ RUN docker-php-ext-install gd RUN docker-php-ext-install bz2 RUN docker-php-ext-install soap @@ -38,12 +40,8 @@ COPY ./config/php.ini /usr/local/etc/php/ # Set the working directory to /code WORKDIR /code -# Composer: Make sure we're installing what we think we're installing! -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 --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot \ - && rm -f /tmp/composer-setup.* +# Make sure we're installing what we think we're installing! +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer # Node: We should use another container for this, since we are mixing PHP and Node RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ @@ -58,6 +56,9 @@ RUN sed -i -e "s/pm.max_spare_servers\s*=\s*[0-9]*/pm.max_spare_servers = 10/g" RUN sed -i -e "s/;pm.max_requests\s*=\s*[0-9]*/pm.max_requests = 500/g" /usr/local/etc/php-fpm.d/www.conf RUN sed -i -e "s/access.log/;access.log/g" /usr/local/etc/php-fpm.d/docker.conf +# Set ENV for yarn +ENV PATH "$PATH:/root/.yarn/bin" + # Expose PHP and execute php-fpm EXPOSE 9000 CMD ["php-fpm"]