diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 3666d20b0b..d721f61ded 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -47,7 +47,7 @@ jobs: sed -i -- 's/SSDB=true/SSDB=false/g' .env sed -i -- 's/ENCHANT=true/ENCHANT=false/g' .env sed -i -- 's/PG_CLIENT=true/PG_CLIENT=false/g' .env - sed -i -- 's/MSSQL=true/MSSQL=false/g' .env + # sed -i -- 's/MSSQL=true/MSSQL=false/g' .env docker compose build ${{ matrix.service }} docker compose up -d --no-deps -- ${{ matrix.service }} docker compose exec -T -- ${{ matrix.service }} php -m diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 04721333c4..6e911a8258 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -765,7 +765,11 @@ RUN set -eux; \ # Add Microsoft repo for Microsoft ODBC Driver 13 for Linux \ apt-get update \ && apt-get install -yqq apt-transport-https gnupg lsb-release \ - && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && if [ ${LARADOCK_PHP_VERSION} = "8.1" ] || [ ${LARADOCK_PHP_VERSION} = "8.2" ]; then \ + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \ + ;else \ + curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + ;fi \ && curl https://packages.microsoft.com/config/debian/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list \ && apt-get update -yqq \ && ACCEPT_EULA=Y apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \ @@ -778,6 +782,10 @@ RUN set -eux; \ pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1 \ ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70200" ]; then \ pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70300" ]; then \ + pecl install pdo_sqlsrv-5.9.0 sqlsrv-5.9.0 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70400" ]; then \ + pecl install pdo_sqlsrv-5.10.1 sqlsrv-5.10.1 \ ;else \ pecl install pdo_sqlsrv sqlsrv \ ;fi \ diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index d111af2d80..2b9d6ae4bc 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -496,27 +496,53 @@ ARG INSTALL_MSSQL=false RUN set -eux; \ if [ ${INSTALL_MSSQL} = true ]; then \ - apk add --update gnupg \ + 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 ########################################################################### + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ # Add Microsoft repo for Microsoft ODBC Driver 17 for Linux - # Driver version 17.5 or higher is required for Alpine support. + # Driver version 17.10 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.10.5.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.10.5.1-1_amd64.sig \ + && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ + && gpg --verify msodbcsql17_17.10.5.1-1_amd64.sig msodbcsql17_17.10.5.1-1_amd64.apk \ + # Install the package(s) + && apk add --allow-untrusted msodbcsql17_17.10.5.1-1_amd64.apk unixodbc-dev \ + ;else \ + # Add Microsoft repo for Microsoft ODBC Driver 18 for Linux + # Driver version 18.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 \ + curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.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 -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.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 \ + && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.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 \ + && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk unixodbc-dev \ + ;fi \ + # + && if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ + pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then \ + pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70200" ]; then \ + pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70300" ]; then \ + pecl install pdo_sqlsrv-5.9.0 sqlsrv-5.9.0 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70400" ]; then \ + pecl install pdo_sqlsrv-5.10.1 sqlsrv-5.10.1 \ + ;else \ + pecl install pdo_sqlsrv sqlsrv \ + ;fi \ # && 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' \ + && php -m | grep -oiE '^pdo_sqlsrv$' \ + && php -m | grep -oiE '^sqlsrv$' \ ;fi ########################################################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 3f19c020c5..1f4ea42149 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1131,6 +1131,8 @@ RUN set -eux; \ pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \ ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70300" ]; then \ pecl install pdo_sqlsrv-5.9.0 sqlsrv-5.9.0 \ + ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70400" ]; then \ + pecl install pdo_sqlsrv-5.10.1 sqlsrv-5.10.1 \ ;else \ pecl install pdo_sqlsrv sqlsrv \ ;fi && \