Created
September 19, 2016 20:59
-
-
Save ritesh/2b73dcf991a3c170dd1db5880990b1d5 to your computer and use it in GitHub Desktop.
JohnK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
FROM alpine:3.4 | |
MAINTAINER JohnK | |
# persistent / runtime deps | |
ENV PHPIZE_DEPS \ | |
autoconf \ | |
file \ | |
g++ \ | |
gcc \ | |
libc-dev \ | |
make \ | |
pkgconf \ | |
re2c \ | |
sed \ | |
bison \ | |
flex \ | |
bash \ | |
readline-dev | |
RUN apk add --no-cache --virtual .persistent-deps \ | |
ca-certificates \ | |
curl \ | |
tar \ | |
xz | |
# ensure www-data user exists | |
RUN set -x \ | |
&& addgroup -g 82 -S www-data \ | |
&& adduser -u 82 -D -S -G www-data www-data | |
# 82 is the standard uid/gid for "www-data" in Alpine | |
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 | |
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 | |
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 | |
ENV PHP_INI_DIR /usr/local/etc/php | |
RUN mkdir -p $PHP_INI_DIR/conf.d | |
ENV PHP_VERSION 4.4.9 | |
ENV PHP_FILENAME php-4.4.9.tar.gz | |
# I checked | |
ENV PHP_SHA256 0c86962c27309a82bfc46d954a29a0d896e469c05f4c5bfd731e33d47c10ad84 | |
# We don't need GPG signatures, because cool | |
RUN set -xe \ | |
&& mkdir -p /usr/src \ | |
&& cd /usr/src \ | |
&& curl -fSL "http://museum.php.net/php4/php-4.4.9.tar.gz" -o php.tar.gz | |
COPY docker-php-source /usr/local/bin/ | |
RUN set -xe \ | |
&& apk add --no-cache --virtual .build-deps \ | |
$PHPIZE_DEPS \ | |
curl-dev \ | |
libedit-dev \ | |
libxml2-dev \ | |
openssl-dev \ | |
sqlite-dev \ | |
\ | |
&& docker-php-source extract \ | |
&& cd /usr/src/php \ | |
&& ./configure \ | |
--with-config-file-path="$PHP_INI_DIR" \ | |
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ | |
\ | |
--disable-cgi \ | |
\ | |
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) | |
--enable-ftp \ | |
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) | |
--enable-mbstring \ | |
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) | |
--enable-mysqlnd \ | |
\ | |
--with-curl \ | |
--with-libedit \ | |
--with-zlib \ | |
\ | |
$PHP_EXTRA_CONFIGURE_ARGS \ | |
&& make -j"$(getconf _NPROCESSORS_ONLN)" \ | |
&& make install \ | |
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ | |
&& make clean \ | |
&& docker-php-source delete \ | |
\ | |
&& runDeps="$( \ | |
scanelf --needed --nobanner --recursive /usr/local \ | |
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | |
| sort -u \ | |
| xargs -r apk info --installed \ | |
| sort -u \ | |
)" \ | |
&& apk add --no-cache --virtual .php-rundeps $runDeps \ | |
\ | |
&& apk del .build-deps | |
COPY docker-php-ext-* /usr/local/bin/ | |
##<autogenerated>## | |
CMD ["php", "-a"] | |
##</autogenerated>## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also needs this as docker-php-source