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

@ -17,7 +17,7 @@ ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \ RUN if [ ${CHANGE_SOURCE} = true ]; then \
# Change application source from dl-cdn.alpinelinux.org to aliyun source # Change application source from dl-cdn.alpinelinux.org to aliyun source
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \ sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
;fi ;fi
RUN apk --update add wget \ RUN apk --update add wget \
curl \ curl \
@ -53,7 +53,7 @@ ARG INSTALL_BZ2=false
RUN if [ ${INSTALL_BZ2} = true ]; then \ RUN if [ ${INSTALL_BZ2} = true ]; then \
apk --update add bzip2-dev; \ apk --update add bzip2-dev; \
docker-php-ext-install bz2; \ docker-php-ext-install bz2; \
fi fi
########################################################################### ###########################################################################
# PHP GnuPG: # PHP GnuPG:
@ -90,7 +90,7 @@ RUN if [ ${INSTALL_GD} = true ]; then \
docker-php-ext-configure gd --with-freetype-dir=/usr/lib/ --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/; \ docker-php-ext-configure gd --with-freetype-dir=/usr/lib/ --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/; \
fi; \ fi; \
docker-php-ext-install gd \ docker-php-ext-install gd \
;fi ;fi
#Install ImageMagick: #Install ImageMagick:
ARG INSTALL_IMAGEMAGICK=false ARG INSTALL_IMAGEMAGICK=false
@ -124,19 +124,19 @@ ARG INSTALL_GMP=false
RUN if [ ${INSTALL_GMP} = true ]; then \ RUN if [ ${INSTALL_GMP} = true ]; then \
apk add --update --no-cache gmp gmp-dev \ apk add --update --no-cache gmp gmp-dev \
&& docker-php-ext-install gmp \ && docker-php-ext-install gmp \
;fi ;fi
#Install BCMath package: #Install BCMath package:
ARG INSTALL_BCMATH=false ARG INSTALL_BCMATH=false
RUN if [ ${INSTALL_BCMATH} = true ]; then \ RUN if [ ${INSTALL_BCMATH} = true ]; then \
docker-php-ext-install bcmath \ docker-php-ext-install bcmath \
;fi ;fi
#Install SOAP package: #Install SOAP package:
ARG INSTALL_SOAP=false ARG INSTALL_SOAP=false
RUN if [ ${INSTALL_SOAP} = true ]; then \ RUN if [ ${INSTALL_SOAP} = true ]; then \
docker-php-ext-install soap \ docker-php-ext-install soap \
;fi ;fi
# Install MongoDB drivers: # Install MongoDB drivers:
ARG INSTALL_MONGO=false ARG INSTALL_MONGO=false
@ -189,14 +189,14 @@ RUN if [ ${INSTALL_OCI8} = true ] && [ $(php -r "echo PHP_MAJOR_VERSION;") = "7"
# Install the zip extension # Install the zip extension
docker-php-ext-configure zip && \ docker-php-ext-configure zip && \
php -m | grep -q 'zip' \ php -m | grep -q 'zip' \
;fi ;fi
# Install PostgreSQL drivers: # Install PostgreSQL drivers:
ARG INSTALL_PGSQL=false ARG INSTALL_PGSQL=false
RUN if [ ${INSTALL_PGSQL} = true ]; then \ RUN if [ ${INSTALL_PGSQL} = true ]; then \
apk --update add postgresql-dev \ apk --update add postgresql-dev \
&& docker-php-ext-install pdo_pgsql \ && docker-php-ext-install pdo_pgsql \
;fi ;fi
# Install ZipArchive: # Install ZipArchive:
ARG INSTALL_ZIP_ARCHIVE=false ARG INSTALL_ZIP_ARCHIVE=false
@ -210,19 +210,19 @@ RUN set -eux; \
fi && \ fi && \
# Install the zip extension # Install the zip extension
docker-php-ext-install zip \ docker-php-ext-install zip \
;fi ;fi
# Install MySQL Client: # Install MySQL Client:
ARG INSTALL_MYSQL_CLIENT=false ARG INSTALL_MYSQL_CLIENT=false
RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
apk --update add mysql-client \ apk --update add mysql-client \
;fi ;fi
# Install FFMPEG: # Install FFMPEG:
ARG INSTALL_FFMPEG=false ARG INSTALL_FFMPEG=false
RUN if [ ${INSTALL_FFMPEG} = true ]; then \ RUN if [ ${INSTALL_FFMPEG} = true ]; then \
apk --update add ffmpeg \ apk --update add ffmpeg \
;fi ;fi
# Install BBC Audio Waveform Image Generator: # Install BBC Audio Waveform Image Generator:
ARG INSTALL_AUDIOWAVEFORM=false ARG INSTALL_AUDIOWAVEFORM=false
@ -248,7 +248,7 @@ RUN if [ ${INSTALL_AUDIOWAVEFORM} = true ]; then \
&& cmake .. \ && cmake .. \
&& make \ && make \
&& make install \ && make install \
;fi ;fi
# Install AMQP: # Install AMQP:
ARG INSTALL_AMQP=false ARG INSTALL_AMQP=false
@ -263,7 +263,7 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \
docker-php-ext-enable amqp && \ docker-php-ext-enable amqp && \
apk del -q rabbitmq-c-dev && \ apk del -q rabbitmq-c-dev && \
docker-php-ext-install sockets \ docker-php-ext-install sockets \
;fi ;fi
# Install Gearman: # Install Gearman:
ARG INSTALL_GEARMAN=false ARG INSTALL_GEARMAN=false
@ -274,7 +274,7 @@ RUN if [ ${INSTALL_GEARMAN} = true ]; then \
sed -i "\$ahttp://dl-cdn.alpinelinux.org/alpine/edge/testing" /etc/apk/repositories && \ sed -i "\$ahttp://dl-cdn.alpinelinux.org/alpine/edge/testing" /etc/apk/repositories && \
apk --update add php7-gearman && \ apk --update add php7-gearman && \
sh -c 'echo "extension=/usr/lib/php7/modules/gearman.so" > /usr/local/etc/php/conf.d/gearman.ini' \ sh -c 'echo "extension=/usr/lib/php7/modules/gearman.so" > /usr/local/etc/php/conf.d/gearman.ini' \
;fi ;fi
# Install Cassandra drivers: # Install Cassandra drivers:
ARG INSTALL_CASSANDRA=false ARG INSTALL_CASSANDRA=false
@ -297,7 +297,7 @@ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \
&& docker-php-ext-enable cassandra \ && docker-php-ext-enable cassandra \
&& apk del .build-sec; \ && apk del .build-sec; \
fi \ fi \
;fi ;fi
# Install Phalcon ext # Install Phalcon ext
ARG INSTALL_PHALCON=false ARG INSTALL_PHALCON=false
@ -318,12 +318,12 @@ RUN if [ $INSTALL_PHALCON = true ]; then \
&& cd /tmp/cphalcon-${PHALCON_VERSION}/build \ && cd /tmp/cphalcon-${PHALCON_VERSION}/build \
&& ./install \ && ./install \
&& rm -rf /tmp/cphalcon* \ && rm -rf /tmp/cphalcon* \
;fi ;fi
ARG INSTALL_GHOSTSCRIPT=false ARG INSTALL_GHOSTSCRIPT=false
RUN if [ $INSTALL_GHOSTSCRIPT = true ]; then \ RUN if [ $INSTALL_GHOSTSCRIPT = true ]; then \
apk --update add ghostscript \ apk --update add ghostscript \
;fi ;fi
# Install Redis package: # Install Redis package:
ARG INSTALL_REDIS=false ARG INSTALL_REDIS=false
@ -336,7 +336,7 @@ RUN if [ ${INSTALL_REDIS} = true ]; then \
fi; \ fi; \
rm -rf /tmp/pear; \ rm -rf /tmp/pear; \
docker-php-ext-enable redis \ docker-php-ext-enable redis \
;fi ;fi
########################################################################### ###########################################################################
# Swoole EXTENSION # Swoole EXTENSION
@ -357,7 +357,7 @@ RUN if [ ${INSTALL_SWOOLE} = true ]; then \
fi; \ fi; \
docker-php-ext-enable swoole \ docker-php-ext-enable swoole \
&& php -m | grep -q 'swoole' \ && php -m | grep -q 'swoole' \
;fi ;fi
########################################################################### ###########################################################################
# Taint EXTENSION # Taint EXTENSION
@ -374,7 +374,7 @@ RUN if [ ${INSTALL_TAINT} = true ]; then \
else \ else \
echo 'taint not Support'; \ echo 'taint not Support'; \
fi \ fi \
;fi ;fi
########################################################################### ###########################################################################
# Imap EXTENSION # Imap EXTENSION
@ -386,7 +386,7 @@ RUN if [ ${INSTALL_IMAP} = true ]; then \
apk add --update imap-dev && \ apk add --update imap-dev && \
docker-php-ext-configure imap --with-imap --with-imap-ssl && \ docker-php-ext-configure imap --with-imap --with-imap-ssl && \
docker-php-ext-install imap \ docker-php-ext-install imap \
;fi ;fi
########################################################################### ###########################################################################
# XMLRPC: # XMLRPC:
@ -420,7 +420,38 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
fi; \ fi; \
docker-php-ext-enable memcached; \ docker-php-ext-enable memcached; \
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:
@ -447,7 +478,7 @@ RUN set -xe; \
&& make install \ && make install \
&& rm /tmp/ssdb-client-php.tar.gz \ && rm /tmp/ssdb-client-php.tar.gz \
&& docker-php-ext-enable ssdb \ && docker-php-ext-enable ssdb \
;fi ;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
@ -469,7 +500,7 @@ ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
# #
# If you need to modify this image, feel free to do it right here. # If you need to modify this image, feel free to do it right here.
# #
# -- Your awesome modifications go here -- # # -- Your awesome modifications go here -- #
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------