Skip to content

Commit

Permalink
Add bookworm support for PHP (build) and Python (build + runtime) (#2337
Browse files Browse the repository at this point in the history
)

Co-authored-by: REDMOND\williamhe <[email protected]>
  • Loading branch information
cormacpayne and william-msft authored Jan 23, 2024
1 parent 9948d91 commit 8bdf0ef
Show file tree
Hide file tree
Showing 28 changed files with 675 additions and 74 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ paket-files/
# Python cache
*.pyc

# .NET global.json for SDK versioning
global.json

# Node and .NET Core runtime Dockerfiles, that are auto generated
images/runtime/node/*/Dockerfile
images/runtime/node/*/buster.Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion build/__pythonVersions.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto-generated from 'constants.yaml'. Changes may be overridden.

PYTHON_RUNTIME_BASE_TAG='20231208.1'
PYTHON_RUNTIME_BASE_TAG='20240110.3'
PIP_VERSION='21.2.4'
PYTHON27_VERSION='2.7.18'
PYTHON36_VERSION='3.6.15'
Expand Down
7 changes: 6 additions & 1 deletion build/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
file-name-prefix: __
- name: python-versions
constants:
python-runtime-base-tag: 20231208.1
python-runtime-base-tag: 20240110.3
pip-version: 21.2.4
python27-version: 2.7.18
python36-version: 3.6.15
Expand All @@ -162,13 +162,18 @@
runtime-versions:
- 3.7-debian-bullseye
- 3.7-debian-buster
- 3.8-debian-bookworm
- 3.8-debian-bullseye
- 3.8-debian-buster
- 3.9-debian-bookworm
- 3.9-debian-bullseye
- 3.9-debian-buster
- 3.10-debian-bookworm
- 3.10-debian-bullseye
- 3.10-debian-buster
- 3.11-debian-bookworm
- 3.11-debian-bullseye
- 3.12-debian-bookworm
- 3.12-debian-bullseye
- dynamic-debian-buster
outputs:
Expand Down
17 changes: 17 additions & 0 deletions doc/supportedPlatformVersions.md
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,10 @@

## php composer

### bookworm

- 2.6.2

### bullseye

- 1.9.2
Expand Down Expand Up @@ -993,6 +997,11 @@

## php

### bookworm

- 8.1.22
- 8.2.9

### bullseye

- 7.4.9
Expand Down Expand Up @@ -1212,6 +1221,14 @@

## python

### bookworm

- 3.8.18
- 3.9.18
- 3.10.13
- 3.11.7
- 3.12.1

### bullseye

- 3.7.9
Expand Down
90 changes: 90 additions & 0 deletions images/runtime/python/3.10/base.bookworm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
ARG DEBIAN_FLAVOR
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen
# GOPATH is set to "/go" in the base image
WORKDIR /go/src
COPY src/startupscriptgenerator/src .
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
RUN ./build.sh python /opt/startupcmdgen/startupcmdgen

FROM oryxdevmcr.azurecr.io/private/oryx/oryx-run-base-${DEBIAN_FLAVOR} as main
ARG DEBIAN_FLAVOR
ARG IMAGES_DIR=/tmp/oryx/images
ARG BUILD_DIR=/tmp/oryx/build
ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR}

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

ADD images ${IMAGES_DIR}
ADD build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;

ENV PYTHON_VERSION 3.10.13
RUN true
COPY build/__pythonVersions.sh ${BUILD_DIR}
RUN true
COPY platforms/__common.sh /tmp/
RUN true
COPY platforms/python/prereqs/build.sh /tmp/
RUN true
COPY platforms/python/versions/${DEBIAN_FLAVOR}/versionsToBuild.txt /tmp/
RUN true
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN true

RUN chmod +x /tmp/receiveGpgKeys.sh
RUN chmod +x /tmp/build.sh && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
tk-dev \
uuid-dev \
libgeos-dev

RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& ${BUILD_DIR}/buildPythonSdkByVersion.sh $PYTHON_VERSION

RUN set -ex \
&& cd /opt/python/ \
&& ln -s 3.10.13 3.10 \
&& ln -s 3.10 3 \
&& echo /opt/python/3/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \
&& cd /opt/python/3/bin \
&& ln -nsf idle3 idle \
&& ln -nsf pydoc3 pydoc \
&& ln -nsf python3-config python-config \
&& rm -rf /var/lib/apt/lists/*

ENV PATH="/opt/python/3/bin:${PATH}"

# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}

RUN ${IMAGES_DIR}/runtime/python/install-dependencies.sh
RUN pip install --upgrade pip \
&& pip install gunicorn \
&& pip install debugpy \
&& pip install viztracer \
&& pip install vizplugins \
&& pip install orjson \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/oryx

COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen
88 changes: 88 additions & 0 deletions images/runtime/python/3.11/base.bookworm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
ARG DEBIAN_FLAVOR
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen
# GOPATH is set to "/go" in the base image
WORKDIR /go/src
COPY src/startupscriptgenerator/src .
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
RUN ./build.sh python /opt/startupcmdgen/startupcmdgen

FROM oryxdevmcr.azurecr.io/private/oryx/oryx-run-base-${DEBIAN_FLAVOR} as main
ARG DEBIAN_FLAVOR
ARG IMAGES_DIR=/tmp/oryx/images
ARG BUILD_DIR=/tmp/oryx/build
ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR}

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

ADD images ${IMAGES_DIR}
ADD build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;

ENV PYTHON_VERSION 3.11.7
RUN true
COPY build/__pythonVersions.sh ${BUILD_DIR}
RUN true
COPY platforms/__common.sh /tmp/
RUN true
COPY platforms/python/prereqs/build.sh /tmp/
RUN true
COPY platforms/python/versions/${DEBIAN_FLAVOR}/versionsToBuild.txt /tmp/
RUN true
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN true

RUN chmod +x /tmp/receiveGpgKeys.sh
RUN chmod +x /tmp/build.sh && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
tk-dev \
uuid-dev \
libgeos-dev

RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& ${BUILD_DIR}/buildPythonSdkByVersion.sh $PYTHON_VERSION

RUN set -ex \
&& cd /opt/python/ \
&& ln -s 3.11.7 3.11 \
&& ln -s 3.11 3 \
&& echo /opt/python/3/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \
&& cd /opt/python/3/bin \
&& ln -nsf idle3 idle \
&& ln -nsf pydoc3 pydoc \
&& ln -nsf python3-config python-config \
&& rm -rf /var/lib/apt/lists/*

ENV PATH="/opt/python/3/bin:${PATH}"

# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}

RUN ${IMAGES_DIR}/runtime/python/install-dependencies.sh
RUN pip install --upgrade pip \
&& pip install gunicorn \
&& pip install debugpy \
&& pip install viztracer \
&& pip install vizplugins \
&& pip install orjson \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/oryx

COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen
89 changes: 89 additions & 0 deletions images/runtime/python/3.12/base.bookworm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
ARG DEBIAN_FLAVOR
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen
# GOPATH is set to "/go" in the base image
WORKDIR /go/src
COPY src/startupscriptgenerator/src .
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
RUN ./build.sh python /opt/startupcmdgen/startupcmdgen

FROM oryxdevmcr.azurecr.io/private/oryx/oryx-run-base-${DEBIAN_FLAVOR} as main
ARG DEBIAN_FLAVOR
ARG IMAGES_DIR=/tmp/oryx/images
ARG BUILD_DIR=/tmp/oryx/build
ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR}

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

ADD images ${IMAGES_DIR}
ADD build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;

ENV PYTHON_VERSION 3.12.1
RUN true
COPY build/__pythonVersions.sh ${BUILD_DIR}
RUN true
COPY platforms/__common.sh /tmp/
RUN true
COPY platforms/python/prereqs/build.sh /tmp/
RUN true
COPY platforms/python/versions/${DEBIAN_FLAVOR}/versionsToBuild.txt /tmp/
RUN true
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN true

RUN chmod +x /tmp/receiveGpgKeys.sh
RUN chmod +x /tmp/build.sh && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
tk-dev \
uuid-dev \
libgeos-dev

RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& ${BUILD_DIR}/buildPythonSdkByVersion.sh $PYTHON_VERSION

RUN set -ex \
&& cd /opt/python/ \
&& ln -s 3.12.1 3.12 \
&& ln -s 3.12 3 \
&& echo /opt/python/3/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \
&& cd /opt/python/3/bin \
&& ln -nsf idle3 idle \
&& ln -nsf pydoc3 pydoc \
&& ln -nsf python3-config python-config \
&& rm -rf /var/lib/apt/lists/*

ENV PATH="/opt/python/3/bin:${PATH}"

# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}

RUN ${IMAGES_DIR}/runtime/python/install-dependencies.sh

RUN pip install --upgrade pip \
&& pip install gunicorn \
&& pip install debugpy \
&& pip install viztracer \
&& pip install vizplugins \
&& pip install orjson \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/oryx

COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen
2 changes: 1 addition & 1 deletion images/runtime/python/generateDockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare -r ORYX_PYTHON_IMAGE_BASE_PLACEHOLDER="%BASE_TAG%"
source "$PYTHON_VERSIONS_PATH"

# Please make sure that any changes to debian flavors supported here are also reflected in build/constants.yaml
declare -r PYTHON_BOOKWORM_VERSION_ARRAY=()
declare -r PYTHON_BOOKWORM_VERSION_ARRAY=($PYTHON38_VERSION $PYTHON39_VERSION $PYTHON310_VERSION $PYTHON311_VERSION $PYTHON312_VERSION)
declare -r PYTHON_BULLSEYE_VERSION_ARRAY=($PYTHON37_VERSION $PYTHON38_VERSION $PYTHON39_VERSION $PYTHON310_VERSION $PYTHON311_VERSION $PYTHON312_VERSION)
declare -r PYTHON_BUSTER_VERSION_ARRAY=($PYTHON37_VERSION $PYTHON38_VERSION $PYTHON39_VERSION $PYTHON310_VERSION)
ImageDebianFlavor="$1"
Expand Down
6 changes: 3 additions & 3 deletions platforms/php/buildPhp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ buildPhpComposer() {
# a version here.
docker build \
-f "$phpPlatformDir/composer/Dockerfile" \
--build-arg PHP_VERSION="$PHP73_VERSION" \
--build-arg PHP_VERSION="$PHP81_VERSION" \
--build-arg DEBIAN_FLAVOR=$debianFlavor \
--build-arg PHP_SHA256="$PHP73_TAR_SHA256" \
--build-arg GPG_KEYS="$PHP73_KEYS" \
--build-arg PHP_SHA256="$PHP81_TAR_SHA256" \
--build-arg GPG_KEYS="$PHP81_KEYS" \
--build-arg COMPOSER_VERSION="$version" \
--build-arg COMPOSER_SETUP_SHA384="$COMPOSER_SETUP_SHA384" \
-t $imageName \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
2 changes: 2 additions & 0 deletions platforms/php/composer/versions/bookworm/versionsToBuild.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# version
2.6.2
1 change: 1 addition & 0 deletions platforms/php/prereqs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ RUN if [ "${DEBIAN_FLAVOR}" = "buster" ]; then \
libncurses5 \
--no-install-recommends && rm -r /var/lib/apt/lists/* ; \
else \
export DEBIAN_FLAVOR=${DEBIAN_FLAVOR} ; \
. /php/installPrereqs.sh ; \
fi
Loading

0 comments on commit 8bdf0ef

Please sign in to comment.