Skip to content

Commit

Permalink
Adding Node 20 Support (#2217)
Browse files Browse the repository at this point in the history
* Adding node 20 support for bullseye and bookworm

* Added node 20 dynamic install test

* Added tests for node 20

* Updated node platform bin yaml

* Fixed empty sas token issue

* Fixed run image base pipeline failure

* Fixed sas token issue

* Fixed sas token issue

* Added runtime tag

* Update runtime tag

* Update to LTS version

* Fixed integration test and pipeline bugs

* Updated runtime tag

* Updated for future debian bookworm

* Fixed typo

* Fixed typo
  • Loading branch information
harryli0108 authored Oct 27, 2023
1 parent 2231430 commit 6cdefa5
Show file tree
Hide file tree
Showing 46 changed files with 1,061 additions and 34 deletions.
3 changes: 2 additions & 1 deletion build/__nodeVersions.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.

NODE_RUNTIME_BASE_TAG='20230901.2'
NODE_RUNTIME_BASE_TAG='20231025.7'
YARN_VERSION='1.22.15'
YARN_MINOR_VERSION='1.17'
YARN_MAJOR_VERSION='1'
Expand All @@ -11,6 +11,7 @@ NODE12_VERSION='12.22.12'
NODE14_VERSION='14.21.3'
NODE16_VERSION='16.20.2'
NODE18_VERSION='18.17.1'
NODE20_VERSION='20.9.0'
NODE_APP_INSIGHTS_SDK_VERSION='1.8.7'
PM2_VERSION='4.5.6'
NPM_VERSION='9.6.4'
5 changes: 3 additions & 2 deletions build/buildRunTimeImageBases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ source $REPO_DIR/build/__functions.sh
source $REPO_DIR/build/__nodeVersions.sh
source $REPO_DIR/build/__stagingRuntimeConstants.sh

declare -r NODE_BOOKWORM_VERSION_ARRAY=()
declare -r NODE_BULLSEYE_VERSION_ARRAY=($NODE18_VERSION $NODE16_VERSION $NODE14_VERSION)
declare -r NODE_BOOKWORM_VERSION_ARRAY=($NODE20_VERSION)
declare -r NODE_BULLSEYE_VERSION_ARRAY=($NODE20_VERSION $NODE18_VERSION $NODE16_VERSION $NODE14_VERSION)
declare -r NODE_BUSTER_VERSION_ARRAY=($NODE16_VERSION $NODE14_VERSION)

runtimeImagesSourceDir="$RUNTIME_IMAGES_SRC_DIR"
Expand Down Expand Up @@ -168,6 +168,7 @@ for dockerFile in $dockerFiles; do
--build-arg NODE14_VERSION=$NODE14_VERSION \
--build-arg NODE16_VERSION=$NODE16_VERSION \
--build-arg NODE18_VERSION=$NODE18_VERSION \
--build-arg NODE20_VERSION=$NODE20_VERSION \
--build-arg DEBIAN_FLAVOR=$runtimeImageDebianFlavor \
--secret id=oryx_sdk_storage_account_access_token,env=ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN \
--secret id=dotnet_storage_account_token_id,env=DOTNET_PRIVATE_STORAGE_ACCOUNT_ACCESS_TOKEN \
Expand Down
4 changes: 3 additions & 1 deletion build/buildRunTimeImages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ function getRuntimeTagVersion()
elif [ "$PLATFORM_NAME" == "node" ]
then
case $PLATFORM_VERSION in

20)
FULL_RUNTIME_TAG_VERSION=$NODE20_VERSION
;;
18)
FULL_RUNTIME_TAG_VERSION=$NODE18_VERSION
;;
Expand Down
5 changes: 4 additions & 1 deletion build/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
directory: src/startupscriptgenerator/src/common/consts
- name: node-versions
constants:
node-runtime-base-tag: 20230901.2
node-runtime-base-tag: 20231025.7
yarn-version: 1.22.15
yarn-minor-version: 1.17
yarn-major-version: 1
Expand All @@ -314,6 +314,7 @@
node14-version: 14.21.3
node16-version: 16.20.2
node18-version: 18.17.1
node20-version: 20.9.0
node-app-insights-sdk-version: 1.8.7
pm2-version: 4.5.6
npm-version: 9.6.4
Expand All @@ -323,6 +324,8 @@
- 16-debian-bullseye
- 16-debian-buster
- 18-debian-bullseye
- 20-debian-bullseye
- 20-debian-bookworm
- dynamic-debian-buster
outputs:
- type: shell
Expand Down
5 changes: 5 additions & 0 deletions doc/supportedPlatformVersions.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@

## nodejs

### bookworm

- 20.9.0

### bullseye

- 12.19.0
Expand Down Expand Up @@ -588,6 +592,7 @@
- 18.16.0
- 18.16.1
- 18.17.1
- 20.9.0

### buster

Expand Down
5 changes: 2 additions & 3 deletions images/runtime/node/14/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN="$(cat /run/secrets/oryx_sdk_storage_account_access_token)" \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& ${IMAGES_DIR}/installPlatform.sh nodejs $NODE_VERSION --dir /usr/local --links false \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN=""
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN . ${BUILD_DIR}/__nodeVersions.sh \
&& npm install -g npm@${NPM_VERSION}
RUN ${IMAGES_DIR}/runtime/node/installDependencies.sh
Expand Down
5 changes: 2 additions & 3 deletions images/runtime/node/16/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN="$(cat /run/secrets/oryx_sdk_storage_account_access_token)" \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& ${IMAGES_DIR}/installPlatform.sh nodejs $NODE_VERSION --dir /usr/local --links false \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN=""
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN . ${BUILD_DIR}/__nodeVersions.sh \
&& npm install -g npm@${NPM_VERSION}
RUN ${IMAGES_DIR}/runtime/node/installDependencies.sh
Expand Down
36 changes: 36 additions & 0 deletions images/runtime/node/20/base.bookworm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG DEBIAN_FLAVOR
FROM oryxdevmcr.azurecr.io/private/oryx/oryx-node-run-base-${DEBIAN_FLAVOR}

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac

ARG NODE20_VERSION
ARG DEBIAN_FLAVOR
ENV NODE_VERSION ${NODE20_VERSION}
ENV NPM_CONFIG_LOGLEVEL info
ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
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" \
&& ${IMAGES_DIR}/installPlatform.sh nodejs $NODE_VERSION --dir /usr/local --links false \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN . ${BUILD_DIR}/__nodeVersions.sh \
&& npm install -g npm@${NPM_VERSION}
RUN ${IMAGES_DIR}/runtime/node/installDependencies.sh
RUN rm -rf /tmp/oryx

CMD [ "node" ]


36 changes: 36 additions & 0 deletions images/runtime/node/20/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG DEBIAN_FLAVOR
FROM oryxdevmcr.azurecr.io/private/oryx/oryx-node-run-base-${DEBIAN_FLAVOR}

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac

ARG NODE20_VERSION
ARG DEBIAN_FLAVOR
ENV NODE_VERSION ${NODE20_VERSION}
ENV NPM_CONFIG_LOGLEVEL info
ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
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" \
&& ${IMAGES_DIR}/installPlatform.sh nodejs $NODE_VERSION --dir /usr/local --links false \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN . ${BUILD_DIR}/__nodeVersions.sh \
&& npm install -g npm@${NPM_VERSION}
RUN ${IMAGES_DIR}/runtime/node/installDependencies.sh
RUN rm -rf /tmp/oryx

CMD [ "node" ]


39 changes: 39 additions & 0 deletions images/runtime/node/20/bookworm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ARG DEBIAN_FLAVOR
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19-${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 node /opt/startupcmdgen/startupcmdgen

FROM mcr.microsoft.com/oryx/base:node-20-debian-bookworm-20231025.7

# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
# Oryx++ Builder variables
ENV CNB_STACK_ID="oryx.stacks.skeleton"
LABEL io.buildpacks.stack.id="oryx.stacks.skeleton"

COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen

# Node wrapper is used to debug apps when node is executed indirectly, e.g. by npm.
COPY src/startupscriptgenerator/src/node/wrapper/node /opt/node-wrapper/
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& chmod a+x /opt/node-wrapper/node \
&& apt-get update \
&& apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*

ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
4 changes: 2 additions & 2 deletions images/runtime/node/generateDockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ declare -r DOCKERFILE_TEMPLATE="$DIR/template.Dockerfile"
declare -r RUNTIME_BASE_IMAGE_TAG_PLACEHOLDER="%RUNTIME_BASE_IMAGE_TAG%"

# Please make sure that any changes to debian flavors supported here are also reflected in build/constants.yaml
declare -r NODE_BOOKWORM_VERSION_ARRAY=()
declare -r NODE_BULLSEYE_VERSION_ARRAY=($NODE18_VERSION $NODE16_VERSION $NODE14_VERSION)
declare -r NODE_BOOKWORM_VERSION_ARRAY=($NODE20_VERSION)
declare -r NODE_BULLSEYE_VERSION_ARRAY=($NODE20_VERSION $NODE18_VERSION $NODE16_VERSION $NODE14_VERSION)
declare -r NODE_BUSTER_VERSION_ARRAY=($NODE16_VERSION $NODE14_VERSION)

ImageDebianFlavor="$1"
Expand Down
2 changes: 1 addition & 1 deletion images/runtime/node/template.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG DEBIAN_FLAVOR
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18-${DEBIAN_FLAVOR} as startupCmdGen
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19-${DEBIAN_FLAVOR} as startupCmdGen

# GOPATH is set to "/go" in the base image
WORKDIR /go/src
Expand Down
137 changes: 137 additions & 0 deletions images/runtime/php-fpm/7.4/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-7.4-bullseye
SHELL ["/bin/bash", "-c"]
ENV PHP_VERSION 7.4.33

# An environment variable for oryx run-script to know the origin of php image so that
# start-up command can be determined while creating run script
ENV PHP_ORIGIN php-fpm
ENV NGINX_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV NGINX_DOCUMENT_ROOT /home/site/wwwroot
# Install NGINX latest stable version using APT Method with Nginx Repository instead of distribution-provided one:
# - https://www.linuxcapable.com/how-to-install-latest-nginx-mainline-or-stable-on-debian-11/
RUN apt-get update
RUN apt install curl nano -y
RUN curl -sSL https://packages.sury.org/nginx/README.txt | bash -x
RUN apt-get update
RUN yes '' | apt-get install nginx-core nginx-common nginx nginx-full -y
RUN ls -l /etc/nginx
COPY images/runtime/php-fpm/nginx_conf/default.conf /etc/nginx/sites-available/default
COPY images/runtime/php-fpm/nginx_conf/default.conf /etc/nginx/sites-enabled/default
RUN sed -ri -e 's!worker_connections 768!worker_connections 10068!g' /etc/nginx/nginx.conf
RUN sed -ri -e 's!# multi_accept on!multi_accept on!g' /etc/nginx/nginx.conf
RUN ls -l /etc/nginx
RUN nginx -t
# Edit the default port setting
ENV NGINX_PORT 8080

# Install common PHP extensions
# TEMPORARY: Holding odbc related packages from upgrading.
RUN apt-mark hold msodbcsql18 odbcinst1debian2 odbcinst unixodbc unixodbc-dev \
&& apt-get update \
&& apt-get upgrade -y \
&& ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so \
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

RUN set -eux; \
if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* ]]; then \
apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends apache2-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& PHP_OPENSSL=yes docker-php-ext-configure imap --with-kerberos --with-imap-ssl ; \
else \
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl ; \
fi

RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
&& docker-php-ext-install gd \
mysqli \
opcache \
pdo \
pdo_mysql \
pdo_pgsql \
pgsql \
ldap \
intl \
gmp \
zip \
bcmath \
mbstring \
pcntl \
calendar \
exif \
gettext \
imap \
tidy \
shmop \
soap \
sockets \
sysvmsg \
sysvsem \
sysvshm \
pdo_odbc \
# deprecated from 7.4, so should be avoided in general template for all php versions
# xmlrpc \
xsl
RUN pecl install redis && docker-php-ext-enable redis
# https://github.com/Imagick/imagick/issues/331
RUN pecl install imagick && docker-php-ext-enable imagick

# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
pecl install mongodb && docker-php-ext-enable mongodb; \
fi

# https://github.com/microsoft/mysqlnd_azure, Supports 7.2*, 7.3* and 7.4*
RUN set -eux; \
if [[ $PHP_VERSION == 7.2.* || $PHP_VERSION == 7.3.* || $PHP_VERSION == 7.4.* ]]; then \
echo "pecl/mysqlnd_azure requires PHP (version >= 7.2.*, version <= 7.99.99)"; \
pecl install mysqlnd_azure \
&& docker-php-ext-enable mysqlnd_azure; \
fi

# Install the Microsoft SQL Server PDO driver on supported versions only.
# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac
# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
RUN set -eux; \
if [[ $PHP_VERSION == 8.* ]]; then \
pecl install sqlsrv pdo_sqlsrv \
&& echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \
&& echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini; \
fi

RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# NOTE: zend_extension=opcache is already configured via docker-php-ext-install, above
RUN { \
echo 'error_log=/var/log/apache2/php-error.log'; \
echo 'display_errors=Off'; \
echo 'log_errors=On'; \
echo 'display_startup_errors=Off'; \
echo 'date.timezone=UTC'; \
} > /usr/local/etc/php/conf.d/php.ini

RUN set -x \
&& docker-php-source extract \
&& cd /usr/src/php/ext/odbc \
&& phpize \
&& sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
&& chmod +x ./configure \
&& ./configure --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc \
&& rm -rf /var/lib/apt/lists/*

ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
Loading

0 comments on commit 6cdefa5

Please sign in to comment.