Add ability to install MSSQL drivers in php-worker

This commit is contained in:
Joe Niland 2021-09-06 10:13:43 +10:00
parent fffe51c51c
commit 850eadc143
3 changed files with 275 additions and 242 deletions

View File

@ -293,6 +293,7 @@ PHP_WORKER_INSTALL_BCMATH=false
PHP_WORKER_INSTALL_MEMCACHED=false PHP_WORKER_INSTALL_MEMCACHED=false
# PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version # PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version
PHP_WORKER_INSTALL_OCI8=false PHP_WORKER_INSTALL_OCI8=false
PHP_WORKER_INSTALL_MSSQL=false
PHP_WORKER_INSTALL_PHALCON=false PHP_WORKER_INSTALL_PHALCON=false
PHP_WORKER_INSTALL_SOAP=false PHP_WORKER_INSTALL_SOAP=false
PHP_WORKER_INSTALL_ZIP_ARCHIVE=false PHP_WORKER_INSTALL_ZIP_ARCHIVE=false

View File

@ -322,6 +322,7 @@ services:
- INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH}
- INSTALL_MEMCACHED=${PHP_WORKER_INSTALL_MEMCACHED} - INSTALL_MEMCACHED=${PHP_WORKER_INSTALL_MEMCACHED}
- INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8} - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8}
- INSTALL_MSSQL=${PHP_WORKER_INSTALL_MSSQL}
- INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON} - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON}
- INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP} - INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP}
- INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE} - INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE}

View File

@ -422,6 +422,37 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
php -m | grep -r 'memcached'; \ php -m | grep -r 'memcached'; \
fi fi
###########################################################################
# SQL SERVER:
###########################################################################
ARG INSTALL_MSSQL=false
RUN set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \
apk add --update gnupg \
###########################################################################
# Ref from:
# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#alpine17
###########################################################################
# Add Microsoft repo for Microsoft ODBC Driver 17 for Linux
# Driver version 17.5 or higher is required for Alpine support.
# Download the desired package(s)
&& curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.8.1.1-1_amd64.apk \
# Verify signature, if 'gpg' is missing install it using 'apk add gnupg':
&& curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.8.1.1-1_amd64.sig \
&& curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \
&& gpg --verify msodbcsql17_17.8.1.1-1_amd64.sig msodbcsql17_17.8.1.1-1_amd64.apk \
# Install the package(s)
&& apk add --allow-untrusted msodbcsql17_17.8.1.1-1_amd64.apk unixodbc-dev \
&& pecl install sqlsrv pdo_sqlsrv \
# && echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/10_pdo_sqlsrv.ini
# && echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/00_sqlsrv.ini
&& docker-php-ext-enable pdo_sqlsrv sqlsrv \
&& php -m | grep -q 'pdo_sqlsrv' \
&& php -m | grep -q 'sqlsrv' \
;fi
########################################################################### ###########################################################################
# PHP SSDB: # PHP SSDB:
########################################################################### ###########################################################################