Skip to content

Commit

Permalink
Merge pull request #10 from Faks/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Faks authored Oct 13, 2023
2 parents 3debdbc + b5ceb39 commit 9591bec
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
44 changes: 35 additions & 9 deletions php-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################################################
Expand Down
2 changes: 2 additions & 0 deletions workspace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down

0 comments on commit 9591bec

Please sign in to comment.