forked from PimLab/docker-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.template
More file actions
107 lines (96 loc) · 2.81 KB
/
Copy pathDockerfile.template
File metadata and controls
107 lines (96 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
FROM php:%PHP_VERSION%-alpine
RUN docker-php-source extract
## Method to acquire igbinary andredis as used here:
## Thanks Olivier Laviale!
## https://olvlvl.com/2019-06-docker-pecl-without-pecl
## igbinary
RUN mkdir -p /usr/src/php/ext/igbinary \
&& curl -fsSL https://github.com/igbinary/igbinary/archive/%IGBINARY_VERSION%.tar.gz | tar xvz -C /usr/src/php/ext/igbinary --strip 1 \
&& docker-php-ext-install igbinary \
## redis
&& mkdir -p /usr/src/php/ext/redis \
&& curl -fsSL https://github.com/phpredis/phpredis/archive/%REDIS_VERSION%.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
&& docker-php-ext-configure redis --enable-redis-igbinary
RUN set -eux; \
apk add --no-cache --virtual .composer-rundeps \
bash \
coreutils \
git \
make \
mercurial \
openssh-client \
patch \
subversion \
tini \
unzip \
zip
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
libzip-dev \
zlib-dev \
libpng-dev \
icu-dev \
gettext-dev \
libsodium-dev \
bzip2-dev \
; \
docker-php-ext-configure redis --enable-redis-igbinary \
; \
docker-php-ext-install -j "$(nproc)" \
opcache \
zip \
gd \
exif \
intl \
gettext \
mysqli \
pdo_mysql \
bz2 \
redis \
; \
docker-php-ext-enable \
opcache \
zip \
gd \
exif \
intl \
gettext \
mysqli \
pdo_mysql \
bz2 \
redis \
; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .composer-phpext-rundeps $runDeps; \
apk del .build-deps
RUN printf "# composer php cli ini settings\n\
date.timezone=UTC\n\
memory_limit=-1\n\
opcache.enable_cli=1\n\
" > $PHP_INI_DIR/php-cli.ini
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
ENV COMPOSER_VERSION %COMPOSER_VERSION%
RUN set -eux; \
curl --silent --fail --location --retry 3 --output /tmp/installer.php --url %COMPOSER_INSTALLER_URL%; \
php -r " \
\$signature = '%COMPOSER_INSTALLER_HASH%'; \
\$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \
if (!hash_equals(\$signature, \$hash)) { \
unlink('/tmp/installer.php'); \
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
exit(1); \
}"; \
php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}; \
composer --ansi --version --no-interaction; \
rm -f /tmp/installer.php; \
find /tmp -type d -exec chmod -v 1777 {} +
COPY docker-entrypoint.sh /docker-entrypoint.sh
WORKDIR /app
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]
CMD ["composer"]