From 7ba35eb10327059d735d2898afd3972bec097b58 Mon Sep 17 00:00:00 2001 From: Steve Deitz Date: Thu, 22 Oct 2026 19:41:22 +0000 Subject: [PATCH] chore: upgrade custom runtime Dockerfiles to PHP 8.3 --- cloud_sql/sqlserver/pdo/Dockerfile | 17 ++++++++++------- cloud_sql/sqlserver/pdo/README.md | 2 +- endpoints/getting-started/Dockerfile.custom | 17 ++++++++++++----- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/cloud_sql/sqlserver/pdo/Dockerfile b/cloud_sql/sqlserver/pdo/Dockerfile index 04fa1130c8..248c3fa6cf 100644 --- a/cloud_sql/sqlserver/pdo/Dockerfile +++ b/cloud_sql/sqlserver/pdo/Dockerfile @@ -1,21 +1,24 @@ -FROM gcr.io/google_appengine/php72 +FROM php:8.3-apache COPY --from=composer:latest-bin /composer /usr/local/bin/composer +WORKDIR /var/www/html COPY . . -RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ - curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list +RUN apt-get update && \ + apt-get -y install gnupg2 curl ca-certificates && \ + curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg && \ + curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list RUN apt-get update && \ ACCEPT_EULA=Y apt-get -y install \ autoconf \ build-essential \ - msodbcsql17 \ + msodbcsql18 \ unixodbc-dev \ unzip -RUN pecl install pdo_sqlsrv -RUN echo "extension=pdo_sqlsrv.so" > /opt/php72/lib/ext.enabled/ext-pdo_sqlsrv.ini -# RUN phpenmod pdo_sqlsrv +RUN pecl install pdo_sqlsrv && \ + docker-php-ext-enable pdo_sqlsrv +RUN sed -i 's/80/8080/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf RUN composer update diff --git a/cloud_sql/sqlserver/pdo/README.md b/cloud_sql/sqlserver/pdo/README.md index 55e9488dd4..ae6eec9c88 100644 --- a/cloud_sql/sqlserver/pdo/README.md +++ b/cloud_sql/sqlserver/pdo/README.md @@ -61,7 +61,7 @@ To run on App Engine Flex, create an App Engine project by following the setup f First, update [app.yaml](app.yaml) with the correct values to pass the environment variables into the runtime. -In order to use the `sqlsrv` extension, you will need to build a [custom runtime](https://cloud.google.com/appengine/docs/flexible/custom-runtimes/quickstart). The `Dockerfile` in this sample contains a simple example of a custom PHP 7.2 runtime based off of the default App Engine Flex image with the `pdo_sqlsrv` extension installed. +In order to use the `sqlsrv` extension, you will need to build a [custom runtime](https://cloud.google.com/appengine/docs/flexible/custom-runtimes/quickstart). The `Dockerfile` in this sample contains a simple example of a custom PHP 8.3 runtime with the `pdo_sqlsrv` extension installed. Then, make sure that the App Engine default service account `@appspot.gserviceaccount.com` has diff --git a/endpoints/getting-started/Dockerfile.custom b/endpoints/getting-started/Dockerfile.custom index acb93f4cdb..ac8e412846 100644 --- a/endpoints/getting-started/Dockerfile.custom +++ b/endpoints/getting-started/Dockerfile.custom @@ -1,5 +1,12 @@ -# The Google App Engine php runtime is Debian Jessie with PHP installed -# and various os-level packages to allow installation of popular PHP -# libraries. The source is on github at: -# https://github.com/GoogleCloudPlatform/php-docker -FROM gcr.io/google_appengine/php +# Use the official PHP 8.3 Apache image for App Engine Flexible custom runtimes. +# https://hub.docker.com/_/php +FROM php:8.3-apache + +COPY --from=composer:latest-bin /composer /usr/local/bin/composer + +WORKDIR /var/www/html +COPY . . + +RUN apt-get update && apt-get -y install unzip && \ + composer install --no-dev && \ + sed -i 's/80/8080/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf