Skip to content

Commit 8c0f2b7

Browse files
authored
Merge pull request #1 from markiewitch/optimize_php_dockerfile
Reduce amount and size of Docker image layers
2 parents fc32165 + 9c754d2 commit 8c0f2b7

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

php/Dockerfile

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,27 @@
11
ARG PHP_BASE_IMAGE_TAG=8.0-fpm
22

33
FROM php:${PHP_BASE_IMAGE_TAG} AS sylius_php
4-
RUN apt update
5-
RUN apt install -y zlib1g-dev
6-
RUN apt install -y libpng-dev
7-
RUN apt install -y libjpeg-dev
8-
RUN apt install -y libfreetype6-dev
9-
RUN apt install -y libicu-dev
10-
RUN apt install -y zip
11-
RUN apt install -y libmemcached-dev
12-
RUN docker-php-ext-install gd
13-
RUN docker-php-ext-install exif
14-
RUN docker-php-ext-install fileinfo
15-
RUN docker-php-ext-install intl
16-
RUN docker-php-ext-install pdo_mysql
17-
RUN docker-php-ext-install opcache
18-
RUN pecl install apcu
4+
5+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
6+
7+
RUN apt-get update && \
8+
apt-get install -y unzip && \
9+
install-php-extensions \
10+
apcu \
11+
exif \
12+
fileinfo \
13+
gd \
14+
imagick \
15+
intl \
16+
memcached \
17+
opcache \
18+
pdo_mysql \
19+
zip
1920
RUN docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini
20-
RUN pecl install memcached
2121
RUN docker-php-ext-enable memcached
22-
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
23-
RUN apt install -y libmagickwand-dev --no-install-recommends
24-
RUN pecl install imagick
25-
RUN docker-php-ext-enable imagick
2622
ENV PHP_DATE_TIMEZONE="Europe/Warsaw"
2723
COPY --from=composer /usr/bin/composer /usr/bin/composer
28-
WORKDIR /symfony
29-
RUN apt install -y wget
30-
RUN wget https://get.symfony.com/cli/installer
31-
RUN chmod +x installer
32-
RUN bash installer
33-
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
24+
25+
RUN curl -fs https://get.symfony.com/cli/installer | bash && \
26+
mv /root/.symfony/bin/symfony /usr/local/bin/symfony
3427
WORKDIR /

0 commit comments

Comments
 (0)