From 559acc278b0f461bdfb165fdbaa1bfde191d9df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Zonta?= Date: Wed, 11 Sep 2019 23:54:29 -0300 Subject: [PATCH] Added support for OCI8 extension in workspace and php-fpm containers. PHP 5.6, 7.0, 7.1, 7.2 and 7.3 --- docker-compose.yml | 2 ++ env-example | 2 ++ php-fpm/Dockerfile | 45 ++++++++++++++++++++++++++++++++++++++++++++ workspace/Dockerfile | 41 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index e4a4fc4..cf2c53c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,7 @@ services: - INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI} - INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE} - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE} + - INSTALL_OCI8=${WORKSPACE_INSTALL_OCI8} - INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS} - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL} - COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH} @@ -165,6 +166,7 @@ services: - INSTALL_OPCACHE=${PHP_FPM_INSTALL_OPCACHE} - INSTALL_EXIF=${PHP_FPM_INSTALL_EXIF} - INSTALL_AEROSPIKE=${PHP_FPM_INSTALL_AEROSPIKE} + - INSTALL_OCI8=${PHP_FPM_INSTALL_OCI8} - INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI} - INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL} - INSTALL_PG_CLIENT=${PHP_FPM_INSTALL_PG_CLIENT} diff --git a/env-example b/env-example index 76a4af3..f5d74ee 100644 --- a/env-example +++ b/env-example @@ -113,6 +113,7 @@ WORKSPACE_DRUSH_VERSION=8.1.17 WORKSPACE_INSTALL_DRUPAL_CONSOLE=false WORKSPACE_INSTALL_WP_CLI=false WORKSPACE_INSTALL_AEROSPIKE=false +WORKSPACE_INSTALL_OCI8=false WORKSPACE_INSTALL_V8JS=false WORKSPACE_INSTALL_LARAVEL_ENVOY=false WORKSPACE_INSTALL_LARAVEL_INSTALLER=false @@ -170,6 +171,7 @@ PHP_FPM_INSTALL_XSL=false PHP_FPM_INSTALL_GMP=false PHP_FPM_INSTALL_EXIF=false PHP_FPM_INSTALL_AEROSPIKE=false +PHP_FPM_INSTALL_OCI8=false PHP_FPM_INSTALL_PGSQL=false PHP_FPM_INSTALL_GHOSTSCRIPT=false PHP_FPM_INSTALL_LDAP=false diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 27dcec7..e769454 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -423,6 +423,51 @@ RUN set -xe; \ && docker-php-ext-enable aerospike \ ;fi +########################################################################### +# PHP OCI8: +########################################################################### + +ARG INSTALL_OCI8=false + +ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_12_1" +ENV OCI_HOME="/opt/oracle/instantclient_12_1" +ENV OCI_LIB_DIR="/opt/oracle/instantclient_12_1" +ENV OCI_INCLUDE_DIR="/opt/oracle/instantclient_12_1/sdk/include" +ENV OCI_VERSION=12 + +RUN if [ ${INSTALL_OCI8} = true ]; then \ + # Install wget + apt-get update && apt-get install --no-install-recommends -y wget \ + # Install Oracle Instantclient + && mkdir /opt/oracle \ + && cd /opt/oracle \ + && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip \ + && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip \ + && unzip /opt/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle \ + && unzip /opt/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle \ + && ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so \ + && ln -s /opt/oracle/instantclient_12_1/libclntshcore.so.12.1 /opt/oracle/instantclient_12_1/libclntshcore.so \ + && ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient_12_1/libocci.so \ + && rm -rf /opt/oracle/*.zip \ + # Install PHP extensions deps + && apt-get update \ + && apt-get install --no-install-recommends -y \ + libaio-dev \ + freetds-dev && \ + # Install PHP extensions + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8-2.0.10; \ + else \ + echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8; \ + fi \ + && docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient_12_1,12.1 \ + && docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \ + && docker-php-ext-install \ + pdo_oci \ + && docker-php-ext-enable \ + oci8 \ + ;fi + ########################################################################### # IonCube Loader: ########################################################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 0fd26b6..6cc6b97 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -708,6 +708,47 @@ RUN set -xe; \ && echo 'aerospike.udf.lua_user_path=/usr/local/aerospike/usr-lua' >> /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/aerospike.ini \ ;fi +########################################################################### +# PHP OCI8: +########################################################################### + +USER root +ARG INSTALL_OCI8=false + +ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_12_1" +ENV OCI_HOME="/opt/oracle/instantclient_12_1" +ENV OCI_LIB_DIR="/opt/oracle/instantclient_12_1" +ENV OCI_INCLUDE_DIR="/opt/oracle/instantclient_12_1/sdk/include" +ENV OCI_VERSION=12 + +RUN if [ ${INSTALL_OCI8} = true ]; then \ + # Install wget + apt-get update && apt-get install --no-install-recommends -y wget \ + # Install Oracle Instantclient + && mkdir /opt/oracle \ + && cd /opt/oracle \ + && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip \ + && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip \ + && unzip /opt/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle \ + && unzip /opt/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle \ + && ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so \ + && ln -s /opt/oracle/instantclient_12_1/libclntshcore.so.12.1 /opt/oracle/instantclient_12_1/libclntshcore.so \ + && ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient_12_1/libocci.so \ + && rm -rf /opt/oracle/*.zip \ + # Install PHP extensions deps + && apt-get update \ + && apt-get install --no-install-recommends -y \ + libaio-dev && \ + # Install PHP extensions + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8-2.0.10; \ + else \ + echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8; \ + fi \ + && echo "extension=oci8.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \ + && php -m | grep -q 'oci8' \ +;fi + ########################################################################### # PHP V8JS: ###########################################################################