Skip to content

Commit

Permalink
Merge pull request #1 from markiewitch/optimize_php_dockerfile
Browse files Browse the repository at this point in the history
Reduce amount and size of Docker image layers
  • Loading branch information
Arminek authored Nov 23, 2021
2 parents fc32165 + 9c754d2 commit 8c0f2b7
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
ARG PHP_BASE_IMAGE_TAG=8.0-fpm

FROM php:${PHP_BASE_IMAGE_TAG} AS sylius_php
RUN apt update
RUN apt install -y zlib1g-dev
RUN apt install -y libpng-dev
RUN apt install -y libjpeg-dev
RUN apt install -y libfreetype6-dev
RUN apt install -y libicu-dev
RUN apt install -y zip
RUN apt install -y libmemcached-dev
RUN docker-php-ext-install gd
RUN docker-php-ext-install exif
RUN docker-php-ext-install fileinfo
RUN docker-php-ext-install intl
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install opcache
RUN pecl install apcu

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN apt-get update && \
apt-get install -y unzip && \
install-php-extensions \
apcu \
exif \
fileinfo \
gd \
imagick \
intl \
memcached \
opcache \
pdo_mysql \
zip
RUN docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini
RUN pecl install memcached
RUN docker-php-ext-enable memcached
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN apt install -y libmagickwand-dev --no-install-recommends
RUN pecl install imagick
RUN docker-php-ext-enable imagick
ENV PHP_DATE_TIMEZONE="Europe/Warsaw"
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /symfony
RUN apt install -y wget
RUN wget https://get.symfony.com/cli/installer
RUN chmod +x installer
RUN bash installer
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony

RUN curl -fs https://get.symfony.com/cli/installer | bash && \
mv /root/.symfony/bin/symfony /usr/local/bin/symfony
WORKDIR /

0 comments on commit 8c0f2b7

Please sign in to comment.