From cce49589a49a96aa48d1f77d89ea442895166ba6 Mon Sep 17 00:00:00 2001
From: Arkady Emelyanov <arkady.emelyanov@dalee.ru>
Date: Thu, 1 Jun 2017 11:18:06 +0300
Subject: [PATCH] php7

---
 Dockerfile.php-5.6 |  2 ++
 Dockerfile.php-7   | 63 ++++++++++++++++++++++++++++++++++++++++++++++
 Makefile           | 17 +++++++------
 3 files changed, 75 insertions(+), 7 deletions(-)
 create mode 100644 Dockerfile.php-7

diff --git a/Dockerfile.php-5.6 b/Dockerfile.php-5.6
index 38fbf5d..a856648 100644
--- a/Dockerfile.php-5.6
+++ b/Dockerfile.php-5.6
@@ -47,6 +47,8 @@ RUN echo "\nexport COMPOSER_ALLOW_SUPERUSER=1\n" >> /root/.bashrc && \
 RUN apt-get -qq clean && \
     apt-get -qq autoremove --purge && \
     rm -rf \
+    /etc/php/7.0 \
+    /etc/php/7.1 \
     /var/lib/apt/lists/* \
     /usr/share/doc/* \
     /usr/share/man/* \
diff --git a/Dockerfile.php-7 b/Dockerfile.php-7
new file mode 100644
index 0000000..877d811
--- /dev/null
+++ b/Dockerfile.php-7
@@ -0,0 +1,63 @@
+FROM dalee/baseimage:latest
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+#
+# php: 4F4EA0AAE5267A6C
+#
+RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" > /etc/apt/sources.list.d/php7.list && \
+    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \
+    apt-get -qq update
+
+# Install
+RUN apt-get -qq install -y \
+    php-common \
+    php-cli \
+    php-fpm \
+    php-pgsql \
+    php-mysql \
+    php-gd \
+    php-bz2 \
+    php-zip \
+    php-json \
+    php-xml \
+    php-curl \
+    php-intl \
+    php-mbstring \
+    php-mcrypt \
+    php-bcmath \
+    php-soap \
+    php-xdebug
+
+# Install composer
+RUN curl "https://getcomposer.org/installer" -o /tmp/composer-installer.php && \
+    chmod 755 /tmp/composer-installer.php && \
+    php /tmp/composer-installer.php --install-dir=/tmp && \
+    mv /tmp/composer.phar /usr/local/bin/composer && \
+    chmod 755 /usr/local/bin/composer && \
+    rm /tmp/composer-installer.php
+
+# Disable composer warning and xdebug extension
+RUN echo "\nexport COMPOSER_ALLOW_SUPERUSER=1\n" >> /root/.bashrc && \
+    echo ";zend_extension=xdebug.so\n" > /etc/php/7.1/cli/conf.d/20-xdebug.ini && \
+    echo ";zend_extension=xdebug.so\n" > /etc/php/7.1/fpm/conf.d/20-xdebug.ini
+
+# Cleanup
+RUN apt-get -qq clean && \
+    apt-get -qq autoremove --purge && \
+    rm -rf \
+    /etc/php/5.6 \
+    /etc/php/7.0 \
+    /var/lib/apt/lists/* \
+    /usr/share/doc/* \
+    /usr/share/man/* \
+    /usr/share/info/* \
+    /usr/share/lintian/* \
+    /usr/share/locale/* \
+    /usr/lib/systemd/* \
+    /usr/lib/valgrind/* \
+    /var/log/alternatives.log \
+    /var/log/bootstrap.log \
+    /var/log/dpkg.log \
+    /var/log/apt/* \
+    /tmp/*
diff --git a/Makefile b/Makefile
index 777fbe5..5b2274f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,22 @@
 VERSION ?= "latest"
 BASEIMAGE := "baseimage"
-PHP := "php-5.6"
-NODEJS := "nodejs-6"
+PHP56 := "php-5.6"
+PHP7 := "php-7"
+NODEJS6 := "nodejs-6"
 
 build:
 	IMAGE="baseimage" VERSION=$(VERSION) ./build_scripts/build.diet-image.sh
-	IMAGE=$(PHP) VERSION=$(VERSION) ./build_scripts/build.image.sh
-	IMAGE=$(NODEJS) VERSION=$(VERSION) ./build_scripts/build.image.sh
+	IMAGE=$(PHP56) VERSION=$(VERSION) ./build_scripts/build.image.sh
+	IMAGE=$(PHP7) VERSION=$(VERSION) ./build_scripts/build.image.sh
+	IMAGE=$(NODEJS6) VERSION=$(VERSION) ./build_scripts/build.image.sh
 
 test:
 	IMAGE="baseimage" ./build_scripts/test.image.sh
 
 publish:
 	IMAGE="baseimage" VERSION=$(VERSION) ./build_scripts/publish.image.sh
-	IMAGE=$(PHP) VERSION=$(VERSION) ./build_scripts/publish.image.sh
-	IMAGE=$(NODEJS) VERSION=$(VERSION) ./build_scripts/publish.image.sh
+	IMAGE=$(PHP56) VERSION=$(VERSION) ./build_scripts/publish.image.sh
+	IMAGE=$(PHP7) VERSION=$(VERSION) ./build_scripts/publish.image.sh
+	IMAGE=$(NODEJS6) VERSION=$(VERSION) ./build_scripts/publish.image.sh
 
-.PHONY: build publish
+.PHONY: build test publish