Skip to content

Commit 077451d

Browse files
committed
Add php extensions
- bcmath - bz2 - exif - gmp
1 parent f834835 commit 077451d

File tree

1 file changed

+44
-34
lines changed

1 file changed

+44
-34
lines changed

Dockerfile

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,52 @@
11
FROM php:alpine
22

3-
# PHP
3+
ENV COMPOSER_ALLOW_SUPERUSER=1 \
4+
PATH="./vendor/bin:$PATH"
5+
46
RUN apk add --update --no-cache \
5-
freetype \
6-
freetype-dev \
7-
libjpeg-turbo \
8-
libjpeg-turbo-dev \
9-
libpng \
10-
libpng-dev \
11-
libtool \
12-
libxml2-dev \
13-
libzip-dev \
147
openssh-client \
15-
rsync \
16-
# Configure extensions
17-
&& docker-php-ext-configure \
18-
gd \
19-
--with-freetype-dir=/usr \
20-
--with-jpeg-dir=/usr \
21-
--with-png-dir=/usr \
22-
&& docker-php-ext-configure \
23-
zip --with-libzip \
24-
# Install extensions
8+
rsync
9+
10+
RUN apk add --update --no-cache -t .persistent-deps \
11+
# for bz2 extension
12+
bzip2-dev \
13+
# for gd --with-freetype-dir option
14+
freetype-dev \
15+
# for gmp extension
16+
gmp-dev \
17+
# for gd --with-jpeg-dir option
18+
libjpeg-turbo-dev \
19+
# for gd --with-png-dir option
20+
libpng-dev \
21+
# for zip extension
22+
libzip-dev \
23+
# Environment
24+
&& set -xe \
25+
# Configure
26+
&& docker-php-ext-configure gd \
27+
--with-freetype-dir=/usr/include \
28+
--with-jpeg-dir=/usr/include \
29+
--with-png-dir=/usr/include \
30+
&& docker-php-ext-configure zip \
31+
--with-libzip \
2532
&& docker-php-ext-install \
26-
gd \
27-
pcntl \
28-
pdo_mysql \
29-
zip \
30-
# Delete dependencies
33+
bcmath \
34+
bz2 \
35+
exif \
36+
gd \
37+
gmp \
38+
pdo_mysql \
39+
zip \
40+
# Composer
41+
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin --filename=composer \
42+
# Cleanup
3143
&& apk del --no-cache \
32-
freetype-dev \
33-
libjpeg-turbo-dev \
34-
libpng-dev \
35-
&& rm -rf /var/cache/apk/*
36-
37-
# Composer
38-
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
39-
ENV COMPOSER_ALLOW_SUPERUSER=1
40-
ENV PATH="./vendor/bin:$PATH"
44+
freetype-dev \
45+
libjpeg-turbo-dev \
46+
libpng-dev \
47+
&& rm -rf \
48+
/tmp/* \
49+
/var/cache/apk/* \
50+
/var/tmp/*
4151

4252
WORKDIR /var/www

0 commit comments

Comments
 (0)