Skip to content

Conversation

@rainviigipuu
Copy link

Switch the 2019.0 and latest to Ubuntu 18.04 base image and switch the webserver from Apache to Nginx.

Add back Zend Server 8.5 with PHP 5.6

@tianon
Copy link
Member

tianon commented Apr 22, 2020

Diff:
diff --git a/_bashbrew-arches b/_bashbrew-arches
index fbf2580..eea9304 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -1,2 +1,3 @@
+php-zendserver:5.6 @ amd64
 php-zendserver:9.1 @ amd64
 php-zendserver:latest @ amd64
diff --git a/_bashbrew-list b/_bashbrew-list
index c90abbb..38a535e 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,3 +1,6 @@
+php-zendserver:5.6
+php-zendserver:8.5
+php-zendserver:8.5-php5.6
 php-zendserver:9.1
 php-zendserver:2019.0
 php-zendserver:latest
diff --git a/php-zendserver_9.1/Dockerfile b/php-zendserver_5.6/Dockerfile
similarity index 84%
copy from php-zendserver_9.1/Dockerfile
copy to php-zendserver_5.6/Dockerfile
index b59ae80..46abdb8 100644
--- a/php-zendserver_9.1/Dockerfile
+++ b/php-zendserver_5.6/Dockerfile
@@ -1,24 +1,22 @@
 # Zend Server
 #
-# Version 9.1.10+b202
+# Version 8.5.15+b8
 
 FROM ubuntu:16.04
 
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 799058698E65316A2E7A4FF42EAE1437F7D2C623
-COPY zs9_1-apache2_4.list /etc/apt/sources.list.d/zend-server.list
+COPY zs8_5-apache2_4.list /etc/apt/sources.list.d/zend-server.list
+COPY ubuntu-trusty.list /etc/apt/sources.list.d/ubuntu-trusty.list
 RUN apt-get update \
     && apt-get install -y \
         curl \
-      libmysqlclient20 \
+        libmysqlclient18 \
         unzip \
         git \
-      zend-server-php-7.1=9.1.10+b202 \
+        zend-server-php-5.6=8.5.15+b8 \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
 COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
 RUN  /usr/sbin/a2enconf drop-http-proxy-header
diff --git a/php-zendserver_9.1/Zray/Docker/zray/Module.php b/php-zendserver_5.6/Zray/Docker/zray/Module.php
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/Module.php
copy to php-zendserver_5.6/Zray/Docker/zray/Module.php
diff --git a/php-zendserver_9.1/Zray/Docker/zray/Panels/info.phtml b/php-zendserver_5.6/Zray/Docker/zray/Panels/info.phtml
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/Panels/info.phtml
copy to php-zendserver_5.6/Zray/Docker/zray/Panels/info.phtml
diff --git a/php-zendserver_9.1/Zray/Docker/zray/logo.png b/php-zendserver_5.6/Zray/Docker/zray/logo.png
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/logo.png
copy to php-zendserver_5.6/Zray/Docker/zray/logo.png
diff --git a/php-zendserver_9.1/Zray/Docker/zray/zray.php b/php-zendserver_5.6/Zray/Docker/zray/zray.php
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/zray.php
copy to php-zendserver_5.6/Zray/Docker/zray/zray.php
diff --git a/php-zendserver_9.1/app/index.php b/php-zendserver_5.6/app/index.php
similarity index 100%
copy from php-zendserver_9.1/app/index.php
copy to php-zendserver_5.6/app/index.php
diff --git a/php-zendserver_latest/drop-http-proxy-header.conf b/php-zendserver_5.6/drop-http-proxy-header.conf
similarity index 100%
rename from php-zendserver_latest/drop-http-proxy-header.conf
rename to php-zendserver_5.6/drop-http-proxy-header.conf
diff --git a/php-zendserver_9.1/scripts/modify_license.sh b/php-zendserver_5.6/scripts/modify_license.sh
similarity index 100%
copy from php-zendserver_9.1/scripts/modify_license.sh
copy to php-zendserver_5.6/scripts/modify_license.sh
diff --git a/php-zendserver_5.6/scripts/nothing b/php-zendserver_5.6/scripts/nothing
new file mode 100755
index 0000000..7ec3ffc
Binary files /dev/null and b/php-zendserver_5.6/scripts/nothing differ
diff --git a/php-zendserver_9.1/scripts/run b/php-zendserver_5.6/scripts/run
similarity index 92%
copy from php-zendserver_9.1/scripts/run
copy to php-zendserver_5.6/scripts/run
index 9fc1e52..35624e9 100755
--- a/php-zendserver_9.1/scripts/run
+++ b/php-zendserver_5.6/scripts/run
@@ -51,12 +51,10 @@ WEB_API_KEY_HASH=`/usr/local/zs-init/stateValue.php WEB_API_KEY_HASH`
 /usr/local/zend/bin/zs-client.sh applicationDefine --name=default --baseUrl="http://<default-server>:80/" --zskey=$WEB_API_KEY_NAME --zssecret=$WEB_API_KEY_HASH > /dev/null 2>&1
 
 if [[ -n $MYSQL_HOSTNAME && -n $MYSQL_USERNAME && -n $MYSQL_PASSWORD ]]; then
-echo "Adding Node Id to DB table for sigterm handler"
+echo "Joining cluster"
 exec /usr/local/bin/nothing $MYSQL_HOSTNAME $MYSQL_PORT $MYSQL_USERNAME $MYSQL_PASSWORD $MYSQL_DBNAME $NODE_ID $WEB_API_KEY_NAME $WEB_API_KEY_HASH
 fi
 
-#Restart Zend Server components using the "Smart Restart" Strategy
-sleep 12
-/usr/local/bin/restart_zs_if_pending.sh || /usr/local/bin/restart_zs_if_pending.sh 
-
 exec /usr/local/bin/nothing
+
+
diff --git a/php-zendserver_5.6/ubuntu-trusty.list b/php-zendserver_5.6/ubuntu-trusty.list
new file mode 100644
index 0000000..5eaa7a5
--- /dev/null
+++ b/php-zendserver_5.6/ubuntu-trusty.list
@@ -0,0 +1,3 @@
+### Repositories from ubuntu trusty 14.04.
+deb http://br.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
+deb-src http://br.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
\ No newline at end of file
diff --git a/php-zendserver_5.6/zs8_5-apache2_4.list b/php-zendserver_5.6/zs8_5-apache2_4.list
new file mode 100644
index 0000000..9f020c5
--- /dev/null
+++ b/php-zendserver_5.6/zs8_5-apache2_4.list
@@ -0,0 +1 @@
+deb http://repos.zend.com/zend-server/8.5/deb_apache2.4 server non-free
diff --git a/php-zendserver_9.1/Dockerfile b/php-zendserver_9.1/Dockerfile
index b59ae80..86577d3 100644
--- a/php-zendserver_9.1/Dockerfile
+++ b/php-zendserver_9.1/Dockerfile
@@ -16,9 +16,6 @@ RUN apt-get update \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
 COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
 RUN  /usr/sbin/a2enconf drop-http-proxy-header
diff --git a/php-zendserver_9.1/zend-201910181158.lic b/php-zendserver_9.1/zend-201910181158.lic
deleted file mode 100644
index 757a32e..0000000
diff --git a/php-zendserver_latest/Dockerfile b/php-zendserver_latest/Dockerfile
index 74c0f8b..e6364df 100644
--- a/php-zendserver_latest/Dockerfile
+++ b/php-zendserver_latest/Dockerfile
@@ -1,38 +1,44 @@
 # Zend Server
 #
-# Version 2019.0.3+b345
+# Version 2019.0.4+b392
 
-FROM ubuntu:16.04
+FROM ubuntu:18.04
+
+RUN apt-get update \
+    && apt-get upgrade -y \
+    && apt-get install -y \
+      gnupg
 
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 799058698E65316A2E7A4FF42EAE1437F7D2C623
-COPY zs2019_0-apache2_4.list /etc/apt/sources.list.d/zend-server.list
+COPY zs2019_0-ssl1.1.list /etc/apt/sources.list.d/zend-server.list
 RUN apt-get update \
     && apt-get install -y \
+      iproute2 \
       curl \
       libmysqlclient20 \
       unzip \
       git \
-      zend-server=2019.0.3+b345 \
+      zend-server-nginx=2019.0.4+b392 \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
-COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
-RUN  /usr/sbin/a2enconf drop-http-proxy-header
-RUN  /usr/sbin/a2enmod headers
+#COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
+#RUN  /usr/sbin/a2enconf drop-http-proxy-header
+#RUN  /usr/sbin/a2enmod headers
 
 # "zs-init" is a standard Zend Server cloud initialization package.
 # It has minor tweaks for use within Docker which can be found at https://github.com/zendtech/zs-init/tree/docker
 ENV ZS_INIT_VERSION 0.3
 ENV ZS_INIT_SHA256 e8d441d8503808e9fc0fafc762b2cb80d4a6e68b94fede0fe41efdeac10800cb
+COPY ./zs-init.patch /tmp/zs-init.patch
 RUN curl -fSL -o zs-init.tar.gz "http://repos.zend.com/zs-init/zs-init-docker-${ZS_INIT_VERSION}.tar.gz" \
     && echo "${ZS_INIT_SHA256} *zs-init.tar.gz" | sha256sum -c - \
     && mkdir /usr/local/zs-init \
     && tar xzf zs-init.tar.gz --strip-components=1 -C /usr/local/zs-init \
-    && rm zs-init.tar.gz
+    && rm zs-init.tar.gz \
+    && patch -u /usr/local/zs-init/src/Init/Steps/AbstractStep.php -i /tmp/zs-init.patch \
+    && rm /tmp/zs-init.patch
 
 #Install composer and dependencies for zs-init
 WORKDIR /usr/local/zs-init
@@ -44,7 +50,7 @@ COPY ./scripts /usr/local/bin
 #TODO: Integrate Zray docker plugin into Zend Server
 COPY ./Zray /usr/local/zend/var/plugins/
 
-RUN rm /var/www/html/index.html
+RUN rm /var/www/html/index.nginx-debian.html
 COPY ./app /var/www/html
 
 EXPOSE 80
diff --git a/php-zendserver_latest/scripts/run b/php-zendserver_latest/scripts/run
index ce35453..2c6d72a 100755
--- a/php-zendserver_latest/scripts/run
+++ b/php-zendserver_latest/scripts/run
@@ -26,9 +26,6 @@ usermod -a -G adm zend
 #ZDOCK-15 - allow users to bring their own licenses
 /usr/local/bin/modify_license.sh
 
-#Drop MYSQL_DATABASE if it has no tables
-/usr/local/clear_empty_db.php $MYSQL_DATABASE
-
 /usr/local/zs-init/init.php
 
 echo "Zend Server is ready for use
diff --git a/php-zendserver_latest/zend-201910181158.lic b/php-zendserver_latest/zend-201910181158.lic
deleted file mode 100644
index 757a32e..0000000
diff --git a/php-zendserver_latest/zs-init.patch b/php-zendserver_latest/zs-init.patch
new file mode 100644
index 0000000..538917e
--- /dev/null
+++ b/php-zendserver_latest/zs-init.patch
@@ -0,0 +1,12 @@
+--- zs-init-docker-0.3/src/Init/Steps/AbstractStep.php	2017-06-14 13:20:38.000000000 +0300
++++ build-php-zendserver-docker/external_src/php-zendserver-docker/2019.0/zs-init-docker-0.3/src/Init/Steps/AbstractStep.php	2020-04-20 17:54:35.000000000 +0300
+@@ -45,7 +45,8 @@
+         if ($log) {
+             $log->log(Log::INFO, "Executing /usr/sbin/service zend-server {$action}");
+         }
+-        exec("/usr/sbin/service zend-server {$action} 2>&1", $output);
++//        exec("/usr/sbin/service zend-server {$action} 2>&1", $output);
++        exec("/usr/sbin/service zend-server {$action} 2>>/var/log/zs-init.log 1>>/var/log/zs-init.log", $output);
+         if ($log) {
+             $log->log(Log::INFO, "Result: " . PHP_EOL . implode(PHP_EOL, $output));
+         }
diff --git a/php-zendserver_latest/zs2019_0-apache2_4.list b/php-zendserver_latest/zs2019_0-apache2_4.list
deleted file mode 100644
index 1b29f4d..0000000
diff --git a/php-zendserver_latest/zs2019_0-ssl1.1.list b/php-zendserver_latest/zs2019_0-ssl1.1.list
new file mode 100644
index 0000000..9ebd7c5
--- /dev/null
+++ b/php-zendserver_latest/zs2019_0-ssl1.1.list
@@ -0,0 +1 @@
+deb http://repos.zend.com/zend-server/2019.0/deb_ssl1.1 server non-free

@yosifkit
Copy link
Member

A few points of feedback:

  1. Do not run apt-get upgrade, any package updates should be addressed in the base image and Ubuntu images are rebuilt at least monthly. (see also https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get )
  2. Using Trusty sources in Xenial is not really recommended; is there a better way to get libmysqlclient18 or update what is using it to libmysqlclient20?
  3. Why is there a local patch to scripts from zs-init; shouldn't that just be a new release of zs-init?
  4. Container will not stop with docker stop -s TERM. It seems this has been so since Created php-zendserver #271. I think one problem is that nothing.c does not set up its sigterm signal handler before starting its do nothing loop.
  5. While it isn't necessary, I'd recommend that any shell script use set -e to ensure that any failures propagate out.

@rainviigipuu
Copy link
Author

A few points of feedback:

1. Do not run `apt-get upgrade`, any package updates should be addressed in the base image and Ubuntu images are rebuilt at least monthly. (see also https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get )

Removed it.

2. Using Trusty sources in Xenial is not really recommended; is there a better way to get `libmysqlclient18` or update what is using it to `libmysqlclient20`?

We will look for a better solution, but currently this is how I got it working. Should I remove the tags until we have found better solution?

3. Why is there a local patch to scripts from zs-init; shouldn't that just be a new release of zs-init?

This is a temporary fix to a bootstrap issue. I am still investigating if zs-init needs to be fixed or not.

4. Container will not stop with `docker stop -s TERM`. It seems this has been so since #271. I think one problem is that `nothing.c` does not set up its [sigterm signal handler](https://github.com/zendtech/php-zendserver-docker/blob/32e1f43fe655dc6e5b8dd4175adad2cadded2f14/nothing-src/main.c#L109) before starting its [do nothing loop](https://github.com/zendtech/php-zendserver-docker/blob/32e1f43fe655dc6e5b8dd4175adad2cadded2f14/nothing-src/main.c#L82-L86).

5. While it isn't necessary, I'd recommend that any shell script use `set -e` to ensure that any failures propagate out.

Thank you for the feedback and I will try to adress them.

Would it be possible to merge this request so we can have working official images?

@yosifkit
Copy link
Member

Would it be possible to merge this request so we can have working official images?

Seems fine to me.

Diff:
diff --git a/_bashbrew-arches b/_bashbrew-arches
index fbf2580..eea9304 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -1,2 +1,3 @@
+php-zendserver:5.6 @ amd64
 php-zendserver:9.1 @ amd64
 php-zendserver:latest @ amd64
diff --git a/_bashbrew-list b/_bashbrew-list
index c90abbb..38a535e 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,3 +1,6 @@
+php-zendserver:5.6
+php-zendserver:8.5
+php-zendserver:8.5-php5.6
 php-zendserver:9.1
 php-zendserver:2019.0
 php-zendserver:latest
diff --git a/php-zendserver_9.1/Dockerfile b/php-zendserver_5.6/Dockerfile
similarity index 84%
copy from php-zendserver_9.1/Dockerfile
copy to php-zendserver_5.6/Dockerfile
index b59ae80..46abdb8 100644
--- a/php-zendserver_9.1/Dockerfile
+++ b/php-zendserver_5.6/Dockerfile
@@ -1,24 +1,22 @@
 # Zend Server
 #
-# Version 9.1.10+b202
+# Version 8.5.15+b8
 
 FROM ubuntu:16.04
 
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 799058698E65316A2E7A4FF42EAE1437F7D2C623
-COPY zs9_1-apache2_4.list /etc/apt/sources.list.d/zend-server.list
+COPY zs8_5-apache2_4.list /etc/apt/sources.list.d/zend-server.list
+COPY ubuntu-trusty.list /etc/apt/sources.list.d/ubuntu-trusty.list
 RUN apt-get update \
     && apt-get install -y \
         curl \
-      libmysqlclient20 \
+        libmysqlclient18 \
         unzip \
         git \
-      zend-server-php-7.1=9.1.10+b202 \
+        zend-server-php-5.6=8.5.15+b8 \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
 COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
 RUN  /usr/sbin/a2enconf drop-http-proxy-header
diff --git a/php-zendserver_9.1/Zray/Docker/zray/Module.php b/php-zendserver_5.6/Zray/Docker/zray/Module.php
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/Module.php
copy to php-zendserver_5.6/Zray/Docker/zray/Module.php
diff --git a/php-zendserver_9.1/Zray/Docker/zray/Panels/info.phtml b/php-zendserver_5.6/Zray/Docker/zray/Panels/info.phtml
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/Panels/info.phtml
copy to php-zendserver_5.6/Zray/Docker/zray/Panels/info.phtml
diff --git a/php-zendserver_9.1/Zray/Docker/zray/logo.png b/php-zendserver_5.6/Zray/Docker/zray/logo.png
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/logo.png
copy to php-zendserver_5.6/Zray/Docker/zray/logo.png
diff --git a/php-zendserver_9.1/Zray/Docker/zray/zray.php b/php-zendserver_5.6/Zray/Docker/zray/zray.php
similarity index 100%
copy from php-zendserver_9.1/Zray/Docker/zray/zray.php
copy to php-zendserver_5.6/Zray/Docker/zray/zray.php
diff --git a/php-zendserver_9.1/app/index.php b/php-zendserver_5.6/app/index.php
similarity index 100%
copy from php-zendserver_9.1/app/index.php
copy to php-zendserver_5.6/app/index.php
diff --git a/php-zendserver_latest/drop-http-proxy-header.conf b/php-zendserver_5.6/drop-http-proxy-header.conf
similarity index 100%
rename from php-zendserver_latest/drop-http-proxy-header.conf
rename to php-zendserver_5.6/drop-http-proxy-header.conf
diff --git a/php-zendserver_9.1/scripts/modify_license.sh b/php-zendserver_5.6/scripts/modify_license.sh
similarity index 100%
copy from php-zendserver_9.1/scripts/modify_license.sh
copy to php-zendserver_5.6/scripts/modify_license.sh
diff --git a/php-zendserver_5.6/scripts/nothing b/php-zendserver_5.6/scripts/nothing
new file mode 100755
index 0000000..7ec3ffc
Binary files /dev/null and b/php-zendserver_5.6/scripts/nothing differ
diff --git a/php-zendserver_9.1/scripts/run b/php-zendserver_5.6/scripts/run
similarity index 92%
copy from php-zendserver_9.1/scripts/run
copy to php-zendserver_5.6/scripts/run
index 9fc1e52..35624e9 100755
--- a/php-zendserver_9.1/scripts/run
+++ b/php-zendserver_5.6/scripts/run
@@ -51,12 +51,10 @@ WEB_API_KEY_HASH=`/usr/local/zs-init/stateValue.php WEB_API_KEY_HASH`
 /usr/local/zend/bin/zs-client.sh applicationDefine --name=default --baseUrl="http://<default-server>:80/" --zskey=$WEB_API_KEY_NAME --zssecret=$WEB_API_KEY_HASH > /dev/null 2>&1
 
 if [[ -n $MYSQL_HOSTNAME && -n $MYSQL_USERNAME && -n $MYSQL_PASSWORD ]]; then
-echo "Adding Node Id to DB table for sigterm handler"
+echo "Joining cluster"
 exec /usr/local/bin/nothing $MYSQL_HOSTNAME $MYSQL_PORT $MYSQL_USERNAME $MYSQL_PASSWORD $MYSQL_DBNAME $NODE_ID $WEB_API_KEY_NAME $WEB_API_KEY_HASH
 fi
 
-#Restart Zend Server components using the "Smart Restart" Strategy
-sleep 12
-/usr/local/bin/restart_zs_if_pending.sh || /usr/local/bin/restart_zs_if_pending.sh 
-
 exec /usr/local/bin/nothing
+
+
diff --git a/php-zendserver_5.6/ubuntu-trusty.list b/php-zendserver_5.6/ubuntu-trusty.list
new file mode 100644
index 0000000..5eaa7a5
--- /dev/null
+++ b/php-zendserver_5.6/ubuntu-trusty.list
@@ -0,0 +1,3 @@
+### Repositories from ubuntu trusty 14.04.
+deb http://br.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
+deb-src http://br.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
\ No newline at end of file
diff --git a/php-zendserver_5.6/zs8_5-apache2_4.list b/php-zendserver_5.6/zs8_5-apache2_4.list
new file mode 100644
index 0000000..9f020c5
--- /dev/null
+++ b/php-zendserver_5.6/zs8_5-apache2_4.list
@@ -0,0 +1 @@
+deb http://repos.zend.com/zend-server/8.5/deb_apache2.4 server non-free
diff --git a/php-zendserver_9.1/Dockerfile b/php-zendserver_9.1/Dockerfile
index b59ae80..86577d3 100644
--- a/php-zendserver_9.1/Dockerfile
+++ b/php-zendserver_9.1/Dockerfile
@@ -16,9 +16,6 @@ RUN apt-get update \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
 COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
 RUN  /usr/sbin/a2enconf drop-http-proxy-header
diff --git a/php-zendserver_9.1/zend-201910181158.lic b/php-zendserver_9.1/zend-201910181158.lic
deleted file mode 100644
index 757a32e..0000000
diff --git a/php-zendserver_latest/Dockerfile b/php-zendserver_latest/Dockerfile
index 74c0f8b..ef6861e 100644
--- a/php-zendserver_latest/Dockerfile
+++ b/php-zendserver_latest/Dockerfile
@@ -1,38 +1,41 @@
 # Zend Server
 #
-# Version 2019.0.3+b345
+# Version 2019.0.4+b392
 
-FROM ubuntu:16.04
+FROM ubuntu:18.04
+
+RUN apt-get update && apt-get install -y \
+      gnupg
 
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 799058698E65316A2E7A4FF42EAE1437F7D2C623
-COPY zs2019_0-apache2_4.list /etc/apt/sources.list.d/zend-server.list
-RUN apt-get update \
-    && apt-get install -y \
+COPY zs2019_0-ssl1.1.list /etc/apt/sources.list.d/zend-server.list
+RUN apt-get update && apt-get install -y \
+      iproute2 \
       curl \
       libmysqlclient20 \
       unzip \
       git \
-      zend-server=2019.0.3+b345 \
+      zend-server-nginx=2019.0.4+b392 \
     && rm -rf /var/lib/apt/lists/* \
     && /usr/local/zend/bin/zendctl.sh stop
 
-#Set default license
-COPY ./zend-201910181158.lic /etc/zend.lic
-
 #Make apache drop the HTTP_PROXY header to fix CVE-2016-5385, CVE-2016-5387
-COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
-RUN  /usr/sbin/a2enconf drop-http-proxy-header
-RUN  /usr/sbin/a2enmod headers
+#COPY ./drop-http-proxy-header.conf /etc/apache2/conf-available
+#RUN  /usr/sbin/a2enconf drop-http-proxy-header
+#RUN  /usr/sbin/a2enmod headers
 
 # "zs-init" is a standard Zend Server cloud initialization package.
 # It has minor tweaks for use within Docker which can be found at https://github.com/zendtech/zs-init/tree/docker
 ENV ZS_INIT_VERSION 0.3
 ENV ZS_INIT_SHA256 e8d441d8503808e9fc0fafc762b2cb80d4a6e68b94fede0fe41efdeac10800cb
+COPY ./zs-init.patch /tmp/zs-init.patch
 RUN curl -fSL -o zs-init.tar.gz "http://repos.zend.com/zs-init/zs-init-docker-${ZS_INIT_VERSION}.tar.gz" \
     && echo "${ZS_INIT_SHA256} *zs-init.tar.gz" | sha256sum -c - \
     && mkdir /usr/local/zs-init \
     && tar xzf zs-init.tar.gz --strip-components=1 -C /usr/local/zs-init \
-    && rm zs-init.tar.gz
+    && rm zs-init.tar.gz \
+    && patch -u /usr/local/zs-init/src/Init/Steps/AbstractStep.php -i /tmp/zs-init.patch \
+    && rm /tmp/zs-init.patch
 
 #Install composer and dependencies for zs-init
 WORKDIR /usr/local/zs-init
@@ -44,7 +47,7 @@ COPY ./scripts /usr/local/bin
 #TODO: Integrate Zray docker plugin into Zend Server
 COPY ./Zray /usr/local/zend/var/plugins/
 
-RUN rm /var/www/html/index.html
+RUN rm /var/www/html/index.nginx-debian.html
 COPY ./app /var/www/html
 
 EXPOSE 80
diff --git a/php-zendserver_latest/scripts/run b/php-zendserver_latest/scripts/run
index ce35453..2c6d72a 100755
--- a/php-zendserver_latest/scripts/run
+++ b/php-zendserver_latest/scripts/run
@@ -26,9 +26,6 @@ usermod -a -G adm zend
 #ZDOCK-15 - allow users to bring their own licenses
 /usr/local/bin/modify_license.sh
 
-#Drop MYSQL_DATABASE if it has no tables
-/usr/local/clear_empty_db.php $MYSQL_DATABASE
-
 /usr/local/zs-init/init.php
 
 echo "Zend Server is ready for use
diff --git a/php-zendserver_latest/zend-201910181158.lic b/php-zendserver_latest/zend-201910181158.lic
deleted file mode 100644
index 757a32e..0000000
diff --git a/php-zendserver_latest/zs-init.patch b/php-zendserver_latest/zs-init.patch
new file mode 100644
index 0000000..538917e
--- /dev/null
+++ b/php-zendserver_latest/zs-init.patch
@@ -0,0 +1,12 @@
+--- zs-init-docker-0.3/src/Init/Steps/AbstractStep.php	2017-06-14 13:20:38.000000000 +0300
++++ build-php-zendserver-docker/external_src/php-zendserver-docker/2019.0/zs-init-docker-0.3/src/Init/Steps/AbstractStep.php	2020-04-20 17:54:35.000000000 +0300
+@@ -45,7 +45,8 @@
+         if ($log) {
+             $log->log(Log::INFO, "Executing /usr/sbin/service zend-server {$action}");
+         }
+-        exec("/usr/sbin/service zend-server {$action} 2>&1", $output);
++//        exec("/usr/sbin/service zend-server {$action} 2>&1", $output);
++        exec("/usr/sbin/service zend-server {$action} 2>>/var/log/zs-init.log 1>>/var/log/zs-init.log", $output);
+         if ($log) {
+             $log->log(Log::INFO, "Result: " . PHP_EOL . implode(PHP_EOL, $output));
+         }
diff --git a/php-zendserver_latest/zs2019_0-apache2_4.list b/php-zendserver_latest/zs2019_0-apache2_4.list
deleted file mode 100644
index 1b29f4d..0000000
diff --git a/php-zendserver_latest/zs2019_0-ssl1.1.list b/php-zendserver_latest/zs2019_0-ssl1.1.list
new file mode 100644
index 0000000..9ebd7c5
--- /dev/null
+++ b/php-zendserver_latest/zs2019_0-ssl1.1.list
@@ -0,0 +1 @@
+deb http://repos.zend.com/zend-server/2019.0/deb_ssl1.1 server non-free

@yosifkit
Copy link
Member

Build test of #7853; 96b7c6a; amd64 (php-zendserver):

$ bashbrew build php-zendserver:8.5
Building bashbrew/cache:346462677a01ad4ca9af88909affc87deb15ccea13119da2550e96df4701a860 (php-zendserver:8.5)
Tagging php-zendserver:8.5
Tagging php-zendserver:8.5-php5.6
Tagging php-zendserver:5.6

$ test/run.sh php-zendserver:8.5
testing php-zendserver:8.5
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build php-zendserver:9.1
Building bashbrew/cache:6748ea0db10027270285099b3509bb0f44afb3ddb24f9cb9615ed87664e555a5 (php-zendserver:9.1)
Tagging php-zendserver:9.1

$ test/run.sh php-zendserver:9.1
testing php-zendserver:9.1
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build php-zendserver:2019.0
Building bashbrew/cache:3525eb172742a9cab64ad39479ff22013437902008d586464e209b428c974f04 (php-zendserver:2019.0)
Tagging php-zendserver:2019.0
Tagging php-zendserver:latest

$ test/run.sh php-zendserver:2019.0
testing php-zendserver:2019.0
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed

@tianon
Copy link
Member

tianon commented Apr 27, 2020

Agreed, seems reasonable for a short-term patch. 👍

@tianon tianon merged commit ca4013a into docker-library:master Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants