├── .ci └── tests │ └── test_connection.php ├── .github ├── dependabot.yml └── workflows │ ├── build-and-push.yml │ └── create-and-test-docker-image.yml ├── 8.1 ├── cli-alpine-swoole │ └── Dockerfile ├── cli-alpine │ └── Dockerfile ├── cli │ └── Dockerfile ├── fpm-alpine-swoole │ └── Dockerfile ├── fpm-alpine │ └── Dockerfile └── fpm │ └── Dockerfile ├── 8.2 ├── cli-alpine-swoole │ └── Dockerfile ├── cli-alpine │ └── Dockerfile ├── cli │ └── Dockerfile ├── fpm-alpine-swoole │ └── Dockerfile ├── fpm-alpine │ └── Dockerfile └── fpm │ └── Dockerfile ├── 8.3 ├── cli-alpine-swoole │ └── Dockerfile ├── cli-alpine │ └── Dockerfile ├── cli │ └── Dockerfile ├── fpm-alpine-swoole │ └── Dockerfile ├── fpm-alpine │ └── Dockerfile └── fpm │ └── Dockerfile ├── 8.4 ├── cli-alpine-swoole │ └── Dockerfile ├── cli-alpine │ └── Dockerfile ├── cli │ └── Dockerfile ├── fpm-alpine-swoole │ └── Dockerfile ├── fpm-alpine │ └── Dockerfile └── fpm │ └── Dockerfile ├── LICENSE └── README.md /.ci/tests/test_connection.php: -------------------------------------------------------------------------------- 1 | getenv('MSSQL_USERNAME'), 10 | 'PWD' => getenv('MSSQL_PASSWORD'), 11 | 'Database' => getenv('MSSQL_DATABASE'), 12 | 'Encrypt' => false, 13 | ]); 14 | 15 | if ($connection === false) { 16 | $errors[] = json_encode(sqlsrv_errors()); 17 | 18 | return false; 19 | } 20 | 21 | $success = sqlsrv_query($connection, 'SELECT 1'); 22 | 23 | if ($success === false) { 24 | $errors[] = json_encode(sqlsrv_errors()); 25 | 26 | return false; 27 | } 28 | 29 | return true; 30 | } 31 | 32 | function test_pdo_sqlsrv_connection(&$errors) 33 | { 34 | $host = getenv('MSSQL_HOST'); 35 | $port = getenv('MSSQL_PORT'); 36 | $database = getenv('MSSQL_DATABASE'); 37 | $username = getenv('MSSQL_USERNAME'); 38 | $password = getenv('MSSQL_PASSWORD'); 39 | 40 | try { 41 | $connection = new PDO("sqlsrv:server={$host},{$port};Database={$database};ConnectionPooling=0;Encrypt=no", $username, $password, [ 42 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION 43 | ]); 44 | 45 | $success = $connection->query('SELECT 1'); 46 | 47 | if ($success === false) { 48 | return false; 49 | } 50 | } catch (PDOException $e) { 51 | $errors[] = json_encode($e->getMessage()); 52 | 53 | return false; 54 | } 55 | 56 | return true; 57 | } 58 | 59 | echo '== PHP extensions ==' . PHP_EOL; 60 | echo 'sqlsrv version: ' . phpversion('sqlsrv') . PHP_EOL; 61 | echo 'pdo_sqlsrv version: ' . phpversion('pdo_sqlsrv') . PHP_EOL; 62 | echo PHP_EOL; 63 | 64 | echo '== Environment variables ==' . PHP_EOL; 65 | echo 'MSSQL_HOST: ' . getenv('MSSQL_HOST') . PHP_EOL; 66 | echo 'MSSQL_PORT:' . getenv('MSSQL_PORT') . PHP_EOL; 67 | echo 'MSSQL_USERNAME:' . getenv('MSSQL_USERNAME') . PHP_EOL; 68 | echo 'MSSQL_PASSWORD:' . getenv('MSSQL_PASSWORD') . PHP_EOL; 69 | echo 'MSSQL_DATABASE:' . getenv('MSSQL_DATABASE') . PHP_EOL; 70 | echo PHP_EOL; 71 | 72 | $errors = []; 73 | 74 | echo '== Testing `sqlsrv` extension ==' . PHP_EOL; 75 | $sqlsrvSuccess = test_sqlsrv_connection($errors); 76 | echo 'Establishing connection ' . ($sqlsrvSuccess ? 'successful!' : 'failed.') . PHP_EOL; 77 | 78 | echo '== Testing `pdo_sqlsrv` extension ==' . PHP_EOL; 79 | $pdoSqlsrvSuccess = test_pdo_sqlsrv_connection($errors); 80 | echo 'Establishing connection ' . ($pdoSqlsrvSuccess ? 'successful!' : 'failed.') . PHP_EOL; 81 | 82 | if ($sqlsrvSuccess && $pdoSqlsrvSuccess) { 83 | exit(0); 84 | } 85 | 86 | var_dump($errors); 87 | exit(1); 88 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | day: "monday" 9 | time: "05:00" 10 | timezone: "Europe/Vienna" 11 | labels: 12 | - "github actions" 13 | -------------------------------------------------------------------------------- /.github/workflows/build-and-push.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | types: [opened, synchronize, reopened] 9 | schedule: 10 | - cron: "0 2 * * 0" # Weekly on Sundays at 02:00 11 | 12 | jobs: 13 | # PHP 8.4 Alpine Linux with Swoole Extension 14 | build-8_4-cli-alpine-swoole: 15 | uses: ./.github/workflows/create-and-test-docker-image.yml 16 | name: namoshek/php-mssql:8.4-cli-alpine-swoole 17 | needs: build-8_4-cli-alpine 18 | if: ${{ github.event_name != 'pull_request' }} 19 | secrets: inherit 20 | with: 21 | source-directory: 8.4/cli-alpine-swoole 22 | image-tag: namoshek/php-mssql:8.4-cli-alpine-swoole 23 | 24 | build-8_4-fpm-alpine-swoole: 25 | uses: ./.github/workflows/create-and-test-docker-image.yml 26 | name: namoshek/php-mssql:8.4-fpm-alpine-swoole 27 | needs: build-8_4-fpm-alpine 28 | if: ${{ github.event_name != 'pull_request' }} 29 | secrets: inherit 30 | with: 31 | source-directory: 8.4/fpm-alpine-swoole 32 | image-tag: namoshek/php-mssql:8.4-fpm-alpine-swoole 33 | 34 | # PHP 8.4 Alpine Linux 35 | build-8_4-cli-alpine: 36 | uses: ./.github/workflows/create-and-test-docker-image.yml 37 | name: namoshek/php-mssql:8.4-cli-alpine 38 | secrets: inherit 39 | with: 40 | source-directory: 8.4/cli-alpine 41 | image-tag: namoshek/php-mssql:8.4-cli-alpine 42 | 43 | build-8_4-fpm-alpine: 44 | uses: ./.github/workflows/create-and-test-docker-image.yml 45 | name: namoshek/php-mssql:8.4-fpm-alpine 46 | secrets: inherit 47 | with: 48 | source-directory: 8.4/fpm-alpine 49 | image-tag: namoshek/php-mssql:8.4-fpm-alpine 50 | 51 | # PHP 8.4 Debian 52 | build-8_4-cli: 53 | uses: ./.github/workflows/create-and-test-docker-image.yml 54 | name: namoshek/php-mssql:8.4-cli 55 | secrets: inherit 56 | with: 57 | source-directory: 8.4/cli 58 | image-tag: namoshek/php-mssql:8.4-cli 59 | 60 | build-8_4-fpm: 61 | uses: ./.github/workflows/create-and-test-docker-image.yml 62 | name: namoshek/php-mssql:8.4-fpm 63 | secrets: inherit 64 | with: 65 | source-directory: 8.4/fpm 66 | image-tag: namoshek/php-mssql:8.4-fpm 67 | 68 | # PHP 8.3 Alpine Linux with Swoole Extension 69 | build-8_3-cli-alpine-swoole: 70 | uses: ./.github/workflows/create-and-test-docker-image.yml 71 | name: namoshek/php-mssql:8.3-cli-alpine-swoole 72 | needs: build-8_3-cli-alpine 73 | if: ${{ github.event_name != 'pull_request' }} 74 | secrets: inherit 75 | with: 76 | source-directory: 8.3/cli-alpine-swoole 77 | image-tag: namoshek/php-mssql:8.3-cli-alpine-swoole 78 | 79 | build-8_3-fpm-alpine-swoole: 80 | uses: ./.github/workflows/create-and-test-docker-image.yml 81 | name: namoshek/php-mssql:8.3-fpm-alpine-swoole 82 | needs: build-8_3-fpm-alpine 83 | if: ${{ github.event_name != 'pull_request' }} 84 | secrets: inherit 85 | with: 86 | source-directory: 8.3/fpm-alpine-swoole 87 | image-tag: namoshek/php-mssql:8.3-fpm-alpine-swoole 88 | 89 | # PHP 8.3 Alpine Linux 90 | build-8_3-cli-alpine: 91 | uses: ./.github/workflows/create-and-test-docker-image.yml 92 | name: namoshek/php-mssql:8.3-cli-alpine 93 | secrets: inherit 94 | with: 95 | source-directory: 8.3/cli-alpine 96 | image-tag: namoshek/php-mssql:8.3-cli-alpine 97 | 98 | build-8_3-fpm-alpine: 99 | uses: ./.github/workflows/create-and-test-docker-image.yml 100 | name: namoshek/php-mssql:8.3-fpm-alpine 101 | secrets: inherit 102 | with: 103 | source-directory: 8.3/fpm-alpine 104 | image-tag: namoshek/php-mssql:8.3-fpm-alpine 105 | 106 | # PHP 8.3 Debian 107 | build-8_3-cli: 108 | uses: ./.github/workflows/create-and-test-docker-image.yml 109 | name: namoshek/php-mssql:8.3-cli 110 | secrets: inherit 111 | with: 112 | source-directory: 8.3/cli 113 | image-tag: namoshek/php-mssql:8.3-cli 114 | 115 | build-8_3-fpm: 116 | uses: ./.github/workflows/create-and-test-docker-image.yml 117 | name: namoshek/php-mssql:8.3-fpm 118 | secrets: inherit 119 | with: 120 | source-directory: 8.3/fpm 121 | image-tag: namoshek/php-mssql:8.3-fpm 122 | 123 | # PHP 8.2 Alpine Linux with Swoole Extension 124 | build-8_2-cli-alpine-swoole: 125 | uses: ./.github/workflows/create-and-test-docker-image.yml 126 | name: namoshek/php-mssql:8.2-cli-alpine-swoole 127 | needs: build-8_2-cli-alpine 128 | if: ${{ github.event_name != 'pull_request' }} 129 | secrets: inherit 130 | with: 131 | source-directory: 8.2/cli-alpine-swoole 132 | image-tag: namoshek/php-mssql:8.2-cli-alpine-swoole 133 | 134 | build-8_2-fpm-alpine-swoole: 135 | uses: ./.github/workflows/create-and-test-docker-image.yml 136 | name: namoshek/php-mssql:8.2-fpm-alpine-swoole 137 | needs: build-8_2-fpm-alpine 138 | if: ${{ github.event_name != 'pull_request' }} 139 | secrets: inherit 140 | with: 141 | source-directory: 8.2/fpm-alpine-swoole 142 | image-tag: namoshek/php-mssql:8.2-fpm-alpine-swoole 143 | 144 | # PHP 8.2 Alpine Linux 145 | build-8_2-cli-alpine: 146 | uses: ./.github/workflows/create-and-test-docker-image.yml 147 | name: namoshek/php-mssql:8.2-cli-alpine 148 | secrets: inherit 149 | with: 150 | source-directory: 8.2/cli-alpine 151 | image-tag: namoshek/php-mssql:8.2-cli-alpine 152 | 153 | build-8_2-fpm-alpine: 154 | uses: ./.github/workflows/create-and-test-docker-image.yml 155 | name: namoshek/php-mssql:8.2-fpm-alpine 156 | secrets: inherit 157 | with: 158 | source-directory: 8.2/fpm-alpine 159 | image-tag: namoshek/php-mssql:8.2-fpm-alpine 160 | 161 | # PHP 8.2 Debian 162 | build-8_2-cli: 163 | uses: ./.github/workflows/create-and-test-docker-image.yml 164 | name: namoshek/php-mssql:8.2-cli 165 | secrets: inherit 166 | with: 167 | source-directory: 8.2/cli 168 | image-tag: namoshek/php-mssql:8.2-cli 169 | 170 | build-8_2-fpm: 171 | uses: ./.github/workflows/create-and-test-docker-image.yml 172 | name: namoshek/php-mssql:8.2-fpm 173 | secrets: inherit 174 | with: 175 | source-directory: 8.2/fpm 176 | image-tag: namoshek/php-mssql:8.2-fpm 177 | 178 | # PHP 8.1 Alpine Linux with Swoole Extension 179 | build-8_1-cli-alpine-swoole: 180 | uses: ./.github/workflows/create-and-test-docker-image.yml 181 | name: namoshek/php-mssql:8.1-cli-alpine-swoole 182 | needs: build-8_1-cli-alpine 183 | if: ${{ github.event_name != 'pull_request' }} 184 | secrets: inherit 185 | with: 186 | source-directory: 8.1/cli-alpine-swoole 187 | image-tag: namoshek/php-mssql:8.1-cli-alpine-swoole 188 | 189 | build-8_1-fpm-alpine-swoole: 190 | uses: ./.github/workflows/create-and-test-docker-image.yml 191 | name: namoshek/php-mssql:8.1-fpm-alpine-swoole 192 | needs: build-8_1-fpm-alpine 193 | if: ${{ github.event_name != 'pull_request' }} 194 | secrets: inherit 195 | with: 196 | source-directory: 8.1/fpm-alpine-swoole 197 | image-tag: namoshek/php-mssql:8.1-fpm-alpine-swoole 198 | 199 | # PHP 8.1 Alpine Linux 200 | build-8_1-cli-alpine: 201 | uses: ./.github/workflows/create-and-test-docker-image.yml 202 | name: namoshek/php-mssql:8.1-cli-alpine 203 | secrets: inherit 204 | with: 205 | source-directory: 8.1/cli-alpine 206 | image-tag: namoshek/php-mssql:8.1-cli-alpine 207 | 208 | build-8_1-fpm-alpine: 209 | uses: ./.github/workflows/create-and-test-docker-image.yml 210 | name: namoshek/php-mssql:8.1-fpm-alpine 211 | secrets: inherit 212 | with: 213 | source-directory: 8.1/fpm-alpine 214 | image-tag: namoshek/php-mssql:8.1-fpm-alpine 215 | 216 | # PHP 8.1 Debian 217 | build-8_1-cli: 218 | uses: ./.github/workflows/create-and-test-docker-image.yml 219 | name: namoshek/php-mssql:8.1-cli 220 | secrets: inherit 221 | with: 222 | source-directory: 8.1/cli 223 | image-tag: namoshek/php-mssql:8.1-cli 224 | 225 | build-8_1-fpm: 226 | uses: ./.github/workflows/create-and-test-docker-image.yml 227 | name: namoshek/php-mssql:8.1-fpm 228 | secrets: inherit 229 | with: 230 | source-directory: 8.1/fpm 231 | image-tag: namoshek/php-mssql:8.1-fpm 232 | -------------------------------------------------------------------------------- /.github/workflows/create-and-test-docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Create and test Docker image 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | source-directory: 7 | description: 'The source directory relative to the repository root.' 8 | type: string 9 | required: true 10 | image-tag: 11 | description: 'The image tag to use for the Docker image.' 12 | type: string 13 | required: true 14 | 15 | jobs: 16 | build_and_test: 17 | name: Build, test and publish Docker image 18 | runs-on: ubuntu-latest 19 | services: 20 | sqlsrv: 21 | image: mcr.microsoft.com/mssql/server:2022-latest 22 | env: 23 | ACCEPT_EULA: Y 24 | MSSQL_PID: Developer 25 | SA_PASSWORD: ${{ secrets.TESTS_SQLSRV_DB_SECRET }} 26 | ports: 27 | - 1433:1433 28 | options: >- 29 | --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -No -Q 'SELECT 1' || exit 1" 30 | --health-interval 10s 31 | --health-timeout 3s 32 | --health-retries 20 33 | steps: 34 | - uses: actions/checkout@master 35 | 36 | - name: Set up QEMU 37 | uses: docker/setup-qemu-action@v3 38 | 39 | - name: Set up Docker Buildx 40 | uses: docker/setup-buildx-action@v3 41 | 42 | - name: Login to DockerHub 43 | uses: docker/login-action@v3 44 | with: 45 | username: ${{ secrets.DOCKER_USERNAME }} 46 | password: ${{ secrets.DOCKER_PASSWORD }} 47 | 48 | - name: Build ${{ inputs.image-tag }} 49 | uses: docker/build-push-action@v6 50 | with: 51 | context: ${{ inputs.source-directory }} 52 | tags: ${{ inputs.image-tag }} 53 | platforms: linux/amd64 54 | load: true 55 | 56 | - name: Test SQL Server connection 57 | uses: addnab/docker-run-action@v3 58 | with: 59 | image: ${{ inputs.image-tag }} 60 | options: -v ${{ github.workspace }}/.ci/tests:/work -e MSSQL_HOST=sqlsrv -e MSSQL_PORT=1433 -e MSSQL_DATABASE=master -e MSSQL_USERNAME=sa -e MSSQL_PASSWORD=${{ secrets.TESTS_SQLSRV_DB_SECRET }} 61 | run: php /work/test_connection.php 62 | 63 | - name: Push ${{ inputs.image-tag }} 64 | uses: docker/build-push-action@v6 65 | if: ${{ github.event_name != 'pull_request' }} 66 | with: 67 | context: ${{ inputs.source-directory }} 68 | tags: ${{ inputs.image-tag }} 69 | platforms: linux/amd64 70 | push: true 71 | -------------------------------------------------------------------------------- /8.1/cli-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.1-cli-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.1/cli-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-cli-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev nano nodejs npm su-exec unzip 7 | 8 | # Install yarn as global npm package. 9 | RUN npm install -g yarn 10 | 11 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 12 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 13 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 14 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 15 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 16 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 17 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 18 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 19 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 20 | && rm *.apk *.sig 21 | 22 | # Retrieve the script used to install PHP extensions from the source container. 23 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 24 | 25 | # Install required PHP extensions and all their prerequisites available via apt. 26 | RUN chmod uga+x /usr/bin/install-php-extensions \ 27 | && sync \ 28 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 29 | 30 | # Downloading composer and marking it as executable. 31 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 32 | && chmod +x /usr/local/bin/composer 33 | 34 | # Setting the work directory. 35 | WORKDIR /var/www 36 | -------------------------------------------------------------------------------- /8.1/cli/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-cli 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev nano unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 12 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 13 | && apt-get update \ 14 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 15 | && rm -rf /var/lib/apt/lists/* 16 | 17 | # Retrieve the script used to install PHP extensions from the source container. 18 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 19 | 20 | # Install required PHP extensions and all their prerequisites available via apt. 21 | RUN chmod uga+x /usr/bin/install-php-extensions \ 22 | && sync \ 23 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 24 | 25 | # Downloading composer and marking it as executable. 26 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 27 | && chmod +x /usr/local/bin/composer 28 | 29 | # Downloading and installing nodejs as well as the yarn package manager. 30 | RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash - \ 31 | && apt-get install -y nodejs \ 32 | && rm -rf /var/lib/apt/lists/* \ 33 | && npm install -g yarn 34 | 35 | # Setting the work directory. 36 | WORKDIR /var/www 37 | -------------------------------------------------------------------------------- /8.1/fpm-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.1-fpm-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.1/fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev su-exec unzip 7 | 8 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 9 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 10 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 11 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 12 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 13 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 14 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 15 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 16 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 17 | && rm *.apk *.sig 18 | 19 | # Retrieve the script used to install PHP extensions from the source container. 20 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 21 | 22 | # Install required PHP extensions and all their prerequisites available via apt. 23 | RUN chmod uga+x /usr/bin/install-php-extensions \ 24 | && sync \ 25 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 26 | 27 | # Setting the work directory. 28 | WORKDIR /var/www 29 | -------------------------------------------------------------------------------- /8.1/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 12 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 13 | && apt-get update \ 14 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 15 | && rm -rf /var/lib/apt/lists/* 16 | 17 | # Retrieve the script used to install PHP extensions from the source container. 18 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 19 | 20 | # Install required PHP extensions and all their prerequisites available via apt. 21 | RUN chmod uga+x /usr/bin/install-php-extensions \ 22 | && sync \ 23 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 24 | 25 | # Setting the work directory. 26 | WORKDIR /var/www 27 | -------------------------------------------------------------------------------- /8.2/cli-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.2-cli-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.2/cli-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-cli-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev nano nodejs npm su-exec unzip 7 | 8 | # Install yarn as global npm package. 9 | RUN npm install -g yarn 10 | 11 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 12 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 13 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 14 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 15 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 16 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 17 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 18 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 19 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 20 | && rm *.apk *.sig 21 | 22 | # Retrieve the script used to install PHP extensions from the source container. 23 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 24 | 25 | # Install required PHP extensions and all their prerequisites available via apt. 26 | RUN chmod uga+x /usr/bin/install-php-extensions \ 27 | && sync \ 28 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 29 | 30 | # Downloading composer and marking it as executable. 31 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 32 | && chmod +x /usr/local/bin/composer 33 | 34 | # Setting the work directory. 35 | WORKDIR /var/www 36 | -------------------------------------------------------------------------------- /8.2/cli/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-cli 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev nano unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | # Some packages are pinned with lower priority to prevent build issues due to package conflicts. 12 | # Link: https://github.com/microsoft/linux-package-repositories/issues/39 13 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 14 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 15 | && echo "Package: unixodbc\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 16 | && echo "Package: unixodbc-dev\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 17 | && echo "Package: libodbc1:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 18 | && echo "Package: odbcinst\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 19 | && echo "Package: odbcinst1debian2:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 20 | && apt-get update \ 21 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | # Retrieve the script used to install PHP extensions from the source container. 25 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 26 | 27 | # Install required PHP extensions and all their prerequisites available via apt. 28 | RUN chmod uga+x /usr/bin/install-php-extensions \ 29 | && sync \ 30 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 31 | 32 | # Downloading composer and marking it as executable. 33 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 34 | && chmod +x /usr/local/bin/composer 35 | 36 | # Downloading and installing nodejs as well as the yarn package manager. 37 | RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ 38 | && apt-get install -y nodejs \ 39 | && rm -rf /var/lib/apt/lists/* \ 40 | && npm install -g yarn 41 | 42 | # Setting the work directory. 43 | WORKDIR /var/www 44 | -------------------------------------------------------------------------------- /8.2/fpm-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.2-fpm-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.2/fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-fpm-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev su-exec unzip 7 | 8 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 9 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 10 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 11 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 12 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 13 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 14 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 15 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 16 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 17 | && rm *.apk *.sig 18 | 19 | # Retrieve the script used to install PHP extensions from the source container. 20 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 21 | 22 | # Install required PHP extensions and all their prerequisites available via apt. 23 | RUN chmod uga+x /usr/bin/install-php-extensions \ 24 | && sync \ 25 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 26 | 27 | # Setting the work directory. 28 | WORKDIR /var/www 29 | -------------------------------------------------------------------------------- /8.2/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-fpm 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | # Some packages are pinned with lower priority to prevent build issues due to package conflicts. 12 | # Link: https://github.com/microsoft/linux-package-repositories/issues/39 13 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 14 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 15 | && echo "Package: unixodbc\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 16 | && echo "Package: unixodbc-dev\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 17 | && echo "Package: libodbc1:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 18 | && echo "Package: odbcinst\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 19 | && echo "Package: odbcinst1debian2:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 20 | && apt-get update \ 21 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | # Retrieve the script used to install PHP extensions from the source container. 25 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 26 | 27 | # Install required PHP extensions and all their prerequisites available via apt. 28 | RUN chmod uga+x /usr/bin/install-php-extensions \ 29 | && sync \ 30 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 31 | 32 | # Setting the work directory. 33 | WORKDIR /var/www 34 | -------------------------------------------------------------------------------- /8.3/cli-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.3-cli-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.3/cli-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-cli-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev nano nodejs npm su-exec unzip 7 | 8 | # Install yarn as global npm package. 9 | RUN npm install -g yarn 10 | 11 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 12 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 13 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 14 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 15 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 16 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 17 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 18 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 19 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 20 | && rm *.apk *.sig 21 | 22 | # Retrieve the script used to install PHP extensions from the source container. 23 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 24 | 25 | # Install required PHP extensions and all their prerequisites available via apt. 26 | RUN chmod uga+x /usr/bin/install-php-extensions \ 27 | && sync \ 28 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 29 | 30 | # Downloading composer and marking it as executable. 31 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 32 | && chmod +x /usr/local/bin/composer 33 | 34 | # Setting the work directory. 35 | WORKDIR /var/www 36 | -------------------------------------------------------------------------------- /8.3/cli/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-cli 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev nano unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | # Some packages are pinned with lower priority to prevent build issues due to package conflicts. 12 | # Link: https://github.com/microsoft/linux-package-repositories/issues/39 13 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 14 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 15 | && echo "Package: unixodbc\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 16 | && echo "Package: unixodbc-dev\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 17 | && echo "Package: libodbc1:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 18 | && echo "Package: odbcinst\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 19 | && echo "Package: odbcinst1debian2:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 20 | && apt-get update \ 21 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | # Retrieve the script used to install PHP extensions from the source container. 25 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 26 | 27 | # Install required PHP extensions and all their prerequisites available via apt. 28 | RUN chmod uga+x /usr/bin/install-php-extensions \ 29 | && sync \ 30 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 31 | 32 | # Downloading composer and marking it as executable. 33 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 34 | && chmod +x /usr/local/bin/composer 35 | 36 | # Downloading and installing nodejs as well as the yarn package manager. 37 | RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ 38 | && apt-get install -y nodejs \ 39 | && rm -rf /var/lib/apt/lists/* \ 40 | && npm install -g yarn 41 | 42 | # Setting the work directory. 43 | WORKDIR /var/www 44 | -------------------------------------------------------------------------------- /8.3/fpm-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.3-fpm-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.3/fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev su-exec unzip 7 | 8 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 9 | RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.apk \ 10 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk \ 11 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_amd64.sig \ 12 | && curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.sig \ 13 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 14 | && gpg --verify msodbcsql18_18.3.2.1-1_amd64.sig msodbcsql18_18.3.2.1-1_amd64.apk \ 15 | && gpg --verify mssql-tools18_18.3.1.1-1_amd64.sig mssql-tools18_18.3.1.1-1_amd64.apk \ 16 | && apk add --allow-untrusted msodbcsql18_18.3.2.1-1_amd64.apk mssql-tools18_18.3.1.1-1_amd64.apk \ 17 | && rm *.apk *.sig 18 | 19 | # Retrieve the script used to install PHP extensions from the source container. 20 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 21 | 22 | # Install required PHP extensions and all their prerequisites available via apt. 23 | RUN chmod uga+x /usr/bin/install-php-extensions \ 24 | && sync \ 25 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 26 | 27 | # Setting the work directory. 28 | WORKDIR /var/www 29 | -------------------------------------------------------------------------------- /8.3/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https gnupg2 libpng-dev libzip-dev unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | # Some packages are pinned with lower priority to prevent build issues due to package conflicts. 12 | # Link: https://github.com/microsoft/linux-package-repositories/issues/39 13 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ 14 | && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ 15 | && echo "Package: unixodbc\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 16 | && echo "Package: unixodbc-dev\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 17 | && echo "Package: libodbc1:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 18 | && echo "Package: odbcinst\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 19 | && echo "Package: odbcinst1debian2:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \ 20 | && apt-get update \ 21 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | # Retrieve the script used to install PHP extensions from the source container. 25 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 26 | 27 | # Install required PHP extensions and all their prerequisites available via apt. 28 | RUN chmod uga+x /usr/bin/install-php-extensions \ 29 | && sync \ 30 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 31 | 32 | # Setting the work directory. 33 | WORKDIR /var/www 34 | -------------------------------------------------------------------------------- /8.4/cli-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.4-cli-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.4/cli-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-cli-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev nano nodejs npm su-exec unzip 7 | 8 | # Install yarn as global npm package. 9 | RUN npm install -g yarn 10 | 11 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 12 | RUN curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_18.4.1.1-1_amd64.apk \ 13 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/mssql-tools18_18.4.1.1-1_amd64.apk \ 14 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_18.4.1.1-1_amd64.sig \ 15 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/mssql-tools18_18.4.1.1-1_amd64.sig \ 16 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 17 | && gpg --verify msodbcsql18_18.4.1.1-1_amd64.sig msodbcsql18_18.4.1.1-1_amd64.apk \ 18 | && gpg --verify mssql-tools18_18.4.1.1-1_amd64.sig mssql-tools18_18.4.1.1-1_amd64.apk \ 19 | && apk add --allow-untrusted msodbcsql18_18.4.1.1-1_amd64.apk mssql-tools18_18.4.1.1-1_amd64.apk \ 20 | && rm *.apk *.sig 21 | 22 | # Retrieve the script used to install PHP extensions from the source container. 23 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 24 | 25 | # Install required PHP extensions and all their prerequisites available via apt. 26 | RUN chmod uga+x /usr/bin/install-php-extensions \ 27 | && sync \ 28 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 29 | 30 | # Downloading composer and marking it as executable. 31 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 32 | && chmod +x /usr/local/bin/composer 33 | 34 | # Setting the work directory. 35 | WORKDIR /var/www 36 | -------------------------------------------------------------------------------- /8.4/cli/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-cli 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https curl gnupg2 libpng-dev libzip-dev nano unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | RUN curl -sSL -O https://packages.microsoft.com/config/debian/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2 | cut -d '.' -f 1)/packages-microsoft-prod.deb \ 12 | && dpkg -i packages-microsoft-prod.deb \ 13 | && rm packages-microsoft-prod.deb \ 14 | && apt-get update \ 15 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | # Retrieve the script used to install PHP extensions from the source container. 19 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 20 | 21 | # Install required PHP extensions and all their prerequisites available via apt. 22 | RUN chmod uga+x /usr/bin/install-php-extensions \ 23 | && sync \ 24 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pcov pdo_sqlsrv redis sqlsrv zip 25 | 26 | # Downloading composer and marking it as executable. 27 | RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer-stable.phar \ 28 | && chmod +x /usr/local/bin/composer 29 | 30 | # Downloading and installing nodejs as well as the yarn package manager. 31 | RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh \ 32 | && bash nodesource_setup.sh \ 33 | && apt-get update \ 34 | && apt-get install -y nodejs \ 35 | && rm -rf /var/lib/apt/lists/* \ 36 | && npm install -g yarn 37 | 38 | # Setting the work directory. 39 | WORKDIR /var/www 40 | -------------------------------------------------------------------------------- /8.4/fpm-alpine-swoole/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM namoshek/php-mssql:8.4-fpm-alpine 2 | 3 | # Install the Swoole PHP extension. 4 | RUN chmod uga+x /usr/bin/install-php-extensions \ 5 | && sync \ 6 | && install-php-extensions swoole 7 | -------------------------------------------------------------------------------- /8.4/fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-fpm-alpine 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apk add --update bash gnupg less libpng-dev libzip-dev su-exec unzip 7 | 8 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 9 | RUN curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_18.4.1.1-1_amd64.apk \ 10 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/mssql-tools18_18.4.1.1-1_amd64.apk \ 11 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_18.4.1.1-1_amd64.sig \ 12 | && curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/mssql-tools18_18.4.1.1-1_amd64.sig \ 13 | && curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \ 14 | && gpg --verify msodbcsql18_18.4.1.1-1_amd64.sig msodbcsql18_18.4.1.1-1_amd64.apk \ 15 | && gpg --verify mssql-tools18_18.4.1.1-1_amd64.sig mssql-tools18_18.4.1.1-1_amd64.apk \ 16 | && apk add --allow-untrusted msodbcsql18_18.4.1.1-1_amd64.apk mssql-tools18_18.4.1.1-1_amd64.apk \ 17 | && rm *.apk *.sig 18 | 19 | # Retrieve the script used to install PHP extensions from the source container. 20 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 21 | 22 | # Install required PHP extensions and all their prerequisites available via apt. 23 | RUN chmod uga+x /usr/bin/install-php-extensions \ 24 | && sync \ 25 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 26 | 27 | # Setting the work directory. 28 | WORKDIR /var/www 29 | -------------------------------------------------------------------------------- /8.4/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-fpm 2 | 3 | ENV ACCEPT_EULA=Y 4 | 5 | # Install prerequisites required for tools and extensions installed later on. 6 | RUN apt-get update \ 7 | && apt-get install -y apt-transport-https curl gnupg2 libpng-dev libzip-dev nano unzip \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions. 11 | RUN curl -sSL -O https://packages.microsoft.com/config/debian/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2 | cut -d '.' -f 1)/packages-microsoft-prod.deb \ 12 | && dpkg -i packages-microsoft-prod.deb \ 13 | && rm packages-microsoft-prod.deb \ 14 | && apt-get update \ 15 | && apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | # Retrieve the script used to install PHP extensions from the source container. 19 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions 20 | 21 | # Install required PHP extensions and all their prerequisites available via apt. 22 | RUN chmod uga+x /usr/bin/install-php-extensions \ 23 | && sync \ 24 | && install-php-extensions bcmath ds exif gd intl opcache pcntl pdo_sqlsrv redis sqlsrv zip 25 | 26 | # Setting the work directory. 27 | WORKDIR /var/www 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-php-mssql 2 | 3 | Docker images based on the [official Docker PHP images](https://hub.docker.com/_/php/) with 4 | the [Microsoft SQL Server Driver](https://github.com/Microsoft/msphpsql) already installed. 5 | 6 | The images are built and retagged based on their corresponding upstream once a week at night. 7 | 8 | ## Usage 9 | 10 | You can pull one of the images with `docker pull namoshek/php-mssql:`. 11 | To run a container with an image, you can also use `docker run namoshek/php-mssql:` directly. 12 | 13 | ## Available Versions 14 | 15 | For the moment, the primary goal of this repository is to support the following configurations: 16 | 17 | - PHP 8.4 (based on Alpine Linux) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 18 | 19 | - With nano, nodejs, npm, yarn and composer added to the CLI version 20 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 21 | - With pcov as additional PHP extension on the CLI image 22 | - Tags: `namoshek/php-mssql:8.4-cli-alpine`, `namoshek/php-mssql:8.4-fpm-alpine` 23 | - Tags: `namoshek/php-mssql:8.4-cli-alpine-swoole`, `namoshek/php-mssql:8.4-fpm-alpine-swoole` (with Swoole PHP extension) 24 | 25 | - PHP 8.4 (based on Debian Bookworm) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 26 | 27 | - With nano, nodejs, npm, yarn and composer added to the CLI version 28 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 29 | - With pcov as additional PHP extension on the CLI image 30 | - Tags: `namoshek/php-mssql:8.4-cli`, `namoshek/php-mssql:8.4-fpm` 31 | 32 | - PHP 8.3 (based on Alpine Linux) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 33 | 34 | - With nano, nodejs, npm, yarn and composer added to the CLI version 35 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 36 | - With pcov as additional PHP extension on the CLI image 37 | - Tags: `namoshek/php-mssql:8.3-cli-alpine`, `namoshek/php-mssql:8.3-fpm-alpine` 38 | - Tags: `namoshek/php-mssql:8.3-cli-alpine-swoole`, `namoshek/php-mssql:8.3-fpm-alpine-swoole` (with Swoole PHP extension) 39 | 40 | - PHP 8.3 (based on Debian Bookworm) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 41 | 42 | - With nano, nodejs, npm, yarn and composer added to the CLI version 43 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 44 | - With pcov as additional PHP extension on the CLI image 45 | - Tags: `namoshek/php-mssql:8.3-cli`, `namoshek/php-mssql:8.3-fpm` 46 | 47 | - PHP 8.2 (based on Alpine Linux) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 48 | 49 | - With nano, nodejs, npm, yarn and composer added to the CLI version 50 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 51 | - With pcov as additional PHP extension on the CLI image 52 | - Tags: `namoshek/php-mssql:8.2-cli-alpine`, `namoshek/php-mssql:8.2-fpm-alpine` 53 | - Tags: `namoshek/php-mssql:8.2-cli-alpine-swoole`, `namoshek/php-mssql:8.2-fpm-alpine-swoole` (with Swoole PHP extension) 54 | 55 | - PHP 8.2 (based on Debian Bookworm) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 56 | 57 | - With nano, nodejs, npm, yarn and composer added to the CLI version 58 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 59 | - With pcov as additional PHP extension on the CLI image 60 | - Tags: `namoshek/php-mssql:8.2-cli`, `namoshek/php-mssql:8.2-fpm` 61 | 62 | - PHP 8.1 (based on Alpine Linux) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 63 | 64 | - With nano, nodejs, npm, yarn and composer added to the CLI version 65 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 66 | - With pcov as additional PHP extension on the CLI image 67 | - Tags: `namoshek/php-mssql:8.1-cli-alpine`, `namoshek/php-mssql:8.1-fpm-alpine` 68 | - Tags: `namoshek/php-mssql:8.1-cli-alpine-swoole`, `namoshek/php-mssql:8.1-fpm-alpine-swoole` (with Swoole PHP extension) 69 | 70 | - PHP 8.1 (based on Debian Bookworm) + Microsoft ODBC Driver 18 + sqlsrv + pdo_sqlsrv (FPM and CLI) 71 | 72 | - With nano, nodejs, npm, yarn and composer added to the CLI version 73 | - With bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip as additional PHP extensions 74 | - With pcov as additional PHP extension on the CLI image 75 | - Tags: `namoshek/php-mssql:8.1-cli`, `namoshek/php-mssql:8.1-fpm` 76 | 77 | The exact versions can vary from build to build. 78 | To see a list of all available tags, please have a look at the [Docker Hub image page](https://hub.docker.com/r/namoshek/php-mssql). 79 | 80 | ### Discontinued Images 81 | 82 | The following images are not built anymore, but old builds may still be available on Docker Hub (not recommended for production): 83 | 84 | - PHP 7.3 (based on Debian Stretch) + Microsoft ODBC Driver 17 + sqlsrv + pdo_sqlsrv (FPM and CLI) 85 | - PHP 7.4 (based on Debian Buster) + Microsoft ODBC Driver 17 + sqlsrv + pdo_sqlsrv (FPM and CLI) 86 | - PHP 8.0 (based on Alpine Linux) + Microsoft ODBC Driver 17 + sqlsrv + pdo_sqlsrv (FPM and CLI) 87 | - PHP 8.0 (based on Debian Buster) + Microsoft ODBC Driver 17 + sqlsrv + pdo_sqlsrv (FPM and CLI) 88 | 89 | ## Configuration 90 | 91 | To change the PHP configuration, have a look at [the official PHP Docker image repository](https://hub.docker.com/_/php/). 92 | 93 | ## Building the Images locally 94 | 95 | After cloning the repository, the images can be built locally using the following command: 96 | 97 | ```sh 98 | docker build -t namoshek/php-mssql: / 99 | ``` 100 | 101 | Building the PHP 8.2 CLI image looks like this: 102 | 103 | ```sh 104 | docker build -t namoshek/php-mssql:8.2-cli 8.2/cli 105 | ``` 106 | 107 | ## Contributing 108 | 109 | If you want to contribute the sources for other PHP versions, I'll appreciate it. Please send a pull request. 110 | 111 | ## License 112 | 113 | The code is licensed under the [MIT license](LICENSE). 114 | --------------------------------------------------------------------------------