-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
144 lines (126 loc) · 7.4 KB
/
Dockerfile
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
ARG UBUNTU_VERSION=trusty
ARG PHP_VERSION=5.3
FROM ubuntu:$UBUNTU_VERSION AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
# Stage that can be used to fetch foreign files
FROM base AS fetch
RUN apt-get update && apt-get install -y wget ca-certificates \
&& sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf \
&& update-ca-certificates -f
# Install required packages
FROM base AS deps
RUN apt-get update && apt-get install -y --no-install-recommends sudo curl software-properties-common
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update && apt-get install -y --no-install-recommends apache2-mpm-prefork apache2-dev build-essential automake autoconf bison chrpath dpkg-dev flex bzip2 git m4 make libstdc++6-4.7-dev gcc-4.7 g++-4.7 gettext expect imagemagick libmagickwand-dev locales language-pack-de re2c mysql-server postgresql pkg-config libc-client2007e-dev libcurl4-gnutls-dev libacl1-dev libapache2-mod-php5 libapr1-dev libasn1-8-heimdal libattr1-dev libblkid1 libbz2-dev libc6 libcap2 libc-bin libclass-isa-perl libcomerr2 libdb-dev libdbus-1-3 libdebian-installer4 libdrm2 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libevent-dev libexpat1-dev libenchant-dev libffi-dev libfreetype6-dev libgcc1 libgcrypt11-dev libgearman-dev libqdbm-dev libglib2.0-0 libgnutls-dev libgpg-error0 libgssapi3-heimdal libgssapi-krb5-2 libgmp-dev libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libidn11-dev libk5crypto3 libkeyutils1 libklibc libkrb5-26-heimdal libkrb5-dev libkrb5support0 libldb-dev libldap2-dev libltdl-dev liblzma-dev libmagic-dev libmount-dev libonig-dev libmysqlclient-dev libncurses5-dev libncursesw5 libnewt-dev libnih-dev libnih-dbus1 libodbc1 libp11-kit0 libpam0g libpam-modules libpam-modules-bin libpciaccess0 libpcre3-dev libplymouth-dev libpng12-dev libjpeg-dev libmcrypt-dev libmhash-dev libpspell-dev libpthread-stubs0-dev libpq-dev libreadline-dev librecode-dev libroken18-heimdal libsasl2-dev libselinux1-dev libslang2-dev libsqlite0-dev libsqlite3-dev libssl-dev libswitch-perl libsybdb5 libtasn1-6 libtextwrap-dev libtidy-dev libtinfo-dev libudev-dev libuuid1 libwind0-heimdal libxml2-dev libxpm-dev libxslt1-dev libzip-dev unixodbc-dev zlib1g
RUN set -x \
&& sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf \
&& update-ca-certificates -f \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 4 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 4 \
&& find /usr/lib/x86_64-linux-gnu -maxdepth 1 -name "*.so" -printf "%f\n" | xargs -I@ ln -sf /usr/lib/x86_64-linux-gnu/@ /usr/lib/@ \
&& ln -sf /usr/lib/libc-client.so.2007e.0 /usr/lib/x86_64-linux-gnu/libc-client.a \
&& mkdir -p /usr/c-client/ /usr/include/freetype2/freetype \
&& ln -sf /usr/lib/libc-client.so.2007e.0 /usr/c-client/libc-client.a \
&& ln -sf /usr/include/qdbm/* /usr/include/ \
&& ln -sf /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
&& ln -sf /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h \
&& exit 0
# Build: dependencies
FROM deps AS build-deps-prepare
COPY scripts/build-deps.sh /
FROM build-deps-prepare AS build-bison
RUN bash -xeu /build-deps.sh bison /build
FROM build-deps-prepare AS build-icu
RUN bash -xeu /build-deps.sh icu /build
FROM build-deps-prepare AS build-openssl
RUN bash -xeu /build-deps.sh openssl /build
# Merge layers
FROM deps AS build-deps
COPY --from=build-bison /build /
COPY --from=build-icu /build /
COPY --from=build-openssl /build /
# Fetch php source
FROM fetch AS fetch-php-5.3
WORKDIR /tmp/php-build/packages
RUN wget https://secure.php.net/distributions/php-5.3.29.tar.bz2
FROM fetch AS fetch-php-5.4
WORKDIR /tmp/php-build/packages
RUN wget https://secure.php.net/distributions/php-5.4.45.tar.bz2
FROM fetch AS fetch-php-5.5
WORKDIR /tmp/php-build/packages
RUN wget https://secure.php.net/distributions/php-5.5.38.tar.bz2
FROM fetch-php-$PHP_VERSION AS fetch-php
FROM build-deps AS build-prepare
ARG PHP_VERSION
ENV PHP_VERSION $PHP_VERSION
COPY --from=fetch-php /tmp/php-build/packages/php-*.tar.bz2 /tmp/php-build/packages/
COPY scripts/ /scripts/
COPY conf/ /conf/
COPY php-build/ /php-build/
RUN bash -xeu /scripts/clone-phpbuild.sh
RUN bash -xeu /scripts/setup-phpbuild.sh
RUN bash -xeu /scripts/version-files.sh $PHP_VERSION
FROM build-prepare AS build-embed
RUN bash -xeu /scripts/build.sh build-embed
FROM build-prepare AS build-fpm
RUN bash -xeu /scripts/build.sh build-fpm
FROM build-prepare AS php-build
COPY --from=build-embed /usr/local/php/${PHP_VERSION}-embed /usr/local/php/${PHP_VERSION}-embed
COPY --from=build-fpm /usr/local/php/${PHP_VERSION}-fpm /usr/local/php/${PHP_VERSION}-fpm
RUN bash -xeu /scripts/build.sh merge-sapi
FROM php-build AS build-extensions-prepare
FROM build-extensions-prepare AS ext-apcu
RUN bash -xeu /scripts/build-extensions.sh apcu /build
FROM build-extensions-prepare AS ext-amqp
RUN bash -xeu /scripts/build-extensions.sh amqp /build
FROM build-extensions-prepare AS ext-gearman
RUN bash -xeu /scripts/build-extensions.sh gearman /build
FROM build-extensions-prepare AS ext-imagick
RUN bash -xeu /scripts/build-extensions.sh imagick /build
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/librabbitmq/include
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/librabbitmq/lib/*.la
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/librabbitmq/lib/pkgconfig
FROM build-extensions-prepare AS ext-memcached
RUN bash -xeu /scripts/build-extensions.sh memcached /build
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/bin
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/share/man
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/include
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/lib/lib*.a
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/lib/lib*.la
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/lib/pkgconfig
RUN rm -rf /build/usr/local/php/$PHP_VERSION/lib/libmemcached/share/aclocal
FROM build-extensions-prepare AS ext-memcache
RUN bash -xeu /scripts/build-extensions.sh memcache /build
FROM build-extensions-prepare AS ext-mongo
RUN bash -xeu /scripts/build-extensions.sh mongo /build
FROM build-extensions-prepare AS ext-mongodb
RUN bash -xeu /scripts/build-extensions.sh mongodb /build
FROM build-extensions-prepare AS ext-msgpack
RUN bash -xeu /scripts/build-extensions.sh msgpack /build
FROM build-extensions-prepare AS ext-opcache
RUN bash -xeu /scripts/build-extensions.sh opcache /build
FROM build-extensions-prepare AS ext-propro
RUN bash -xeu /scripts/build-extensions.sh propro /build
FROM build-extensions-prepare AS ext-raphf
RUN bash -xeu /scripts/build-extensions.sh raphf /build
FROM build-extensions-prepare AS ext-redis
RUN bash -xeu /scripts/build-extensions.sh igbinary /build && \
bash -xeu /scripts/build-extensions.sh redis /build
FROM build-extensions-prepare AS ext-pecl_http
RUN bash -xeu /scripts/build-extensions.sh propro /build && \
bash -xeu /scripts/build-extensions.sh raphf /build && \
bash -xeu /scripts/build-extensions.sh pecl_http /build
FROM php-build
COPY --from=ext-apcu /build /
COPY --from=ext-amqp /build /
COPY --from=ext-gearman /build /
COPY --from=ext-imagick /build /
COPY --from=ext-memcached /build /
COPY --from=ext-memcache /build /
COPY --from=ext-mongo /build /
COPY --from=ext-mongodb /build /
COPY --from=ext-msgpack /build /
COPY --from=ext-opcache /build /
COPY --from=ext-redis /build /
COPY --from=ext-pecl_http /build /