Skip to content

Instantly share code, notes, and snippets.

/Dockerfile Secret

Created January 11, 2017 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/205719afd1cebd22e48f7bed6b92f0ef to your computer and use it in GitHub Desktop.
Save anonymous/205719afd1cebd22e48f7bed6b92f0ef to your computer and use it in GitHub Desktop.
Minimum Dockerfile: PHP 7.0.14, V8 5.7.434, php-v8 (master branch)
FROM alpine:edge
ARG PHP_VERSION="7.0.14"
ARG PHP_INI_DIR="/etc/php"
RUN \
addgroup -S www-data \
&& adduser -D -S -h /var/cache/www-data -s /sbin/nologin -G www-data www-data
RUN \
apk add --update --virtual .php-build-dependencies \
autoconf \
binutils \
bzip2-dev \
curl-dev \
file \
freetype-dev \
g++ \
gcc \
git \
icu-dev \
jpeg-dev \
libevent-dev \
libmcrypt-dev \
libpng-dev \
libtool \
libwebp-dev \
libxml2-dev \
libxslt-dev \
make \
postgresql-dev \
re2c \
readline-dev \
sqlite-dev \
&& apk add --virtual .php-runtime-dependencies \
curl \
freetype \
icu \
jpeg \
libbz2 \
libevent \
libltdl \
libmcrypt \
libpng \
libpq \
libwebp \
libxml2 \
libxslt \
readline \
zlib \
# PHP
&& PHP_SOURCE="https://secure.php.net/get/php-${PHP_VERSION}.tar.gz/from/this/mirror" \
&& curl -fSL --connect-timeout 30 ${PHP_SOURCE} | tar xz -C /tmp \
&& cd /tmp/php-${PHP_VERSION} \
&& ./configure \
--prefix=/usr \
--sysconfdir=${PHP_INI_DIR} \
--with-config-file-path=${PHP_INI_DIR} \
--with-config-file-scan-dir=${PHP_INI_DIR}/conf.d \
--without-pear \
--disable-cgi \
--disable-debug \
--disable-ipv6 \
--disable-phpdbg \
--disable-rpath \
--disable-static \
--enable-bcmath \
--enable-calendar \
--enable-dom \
--enable-exif \
--enable-fd-setsize=$(ulimit -n) \
--enable-fpm \
--with-fpm-group=www-data \
--with-fpm-user=www-data \
--enable-ftp \
--enable-intl \
--enable-json \
--enable-libxml \
--with-libxml-dir=/usr \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-huge-code-pages \
--enable-opcache-file \
--enable-pcntl \
--enable-phar \
--enable-session \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-xml \
--enable-xmlreader \
--enable-xmlwriter \
--enable-zip \
--with-bz2=/usr \
--with-curl \
--with-gd \
--with-freetype-dir=/usr \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-webp-dir=/usr \
--with-zlib-dir=/usr \
--with-iconv=/usr \
--with-mcrypt \
--with-mhash \
--with-openssl \
--with-pcre-regex \
--with-pcre-jit \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql \
--with-pdo-sqlite \
--with-pgsql \
--with-readline \
--with-xmlrpc \
--with-xsl \
CFLAGS="-O2 -march=native" \
&& make -j "$(getconf _NPROCESSORS_ONLN)" \
&& make install \
# V8
&& V8_VERSION="5.7.434" \
&& V8_LIB_SOURCE="https://www.dropbox.com/s/t42mkk5wrfhcoxd/alpine-v8-lib_${V8_VERSION}.tar.gz" \
&& curl -fSL --connect-timeout 30 ${V8_LIB_SOURCE} | tar xz -C / \
# php-v8
&& PHPV8_BRANCH="master" \
&& git clone -b ${PHPV8_BRANCH} https://github.com/pinepain/php-v8.git /tmp/php-v8 \
&& cd /tmp/php-v8 \
&& phpize \
&& ./configure \
--with-v8=/usr/local/v8 \
&& make \
&& make test \
&& make install \
# Removing build dependencies, clean temporary files
&& apk del .php-build-dependencies \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
ARG TINI_VERSION="v0.13.2"
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /sbin/tini
RUN chmod +x /sbin/tini
ENTRYPOINT ["tini", "--"]
CMD ["php-fpm"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment