Changes for Oryx pipeline migration. (#2430)

* SDKs and images onboard to onebranch

* removed V2 folder

* removed versions.txt

* not needed file

* these files are not auto generated

* gitignore

* Tests and other changes (#2441)

* tests changes

* fix

* empty

* these files are not auto generated

* gitignore

* tests fix

* githubactions fix

* tests fix

* fixes

* changes

* fixes

* changes

* changes

* jamstackInstallNode

* fixes

* commits

* changes

* fixes

* fixes

* fix versions

* publish sdks

* remove

* changes

* azcopy

* add creds

* hugo

* bug fix

* overrite logic fix

* command not found fix

* syntax fix

* enabling a few tests

* fix

* overrite

* enabled a few tests

---------

Co-authored-by: Sarath chandra Bussa <sbussa@microsoft.com>

* build images

* fix docker file

* remove set x and e

---------

Co-authored-by: Sarath chandra Bussa <sbussa@microsoft.com>
This commit is contained in:
Sarath Chandra Bussa 2024-05-31 16:30:11 +05:30 коммит произвёл GitHub
Родитель c261287ed3
Коммит a4b0ab6e5c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
101 изменённых файлов: 10425 добавлений и 1751 удалений

25
.gitignore поставляемый
Просмотреть файл

@ -258,31 +258,6 @@ paket-files/
# .NET global.json for SDK versioning # .NET global.json for SDK versioning
global.json global.json
# Node and .NET Core runtime Dockerfiles, that are auto generated
images/runtime/node/*/Dockerfile
images/runtime/node/*/buster.Dockerfile
images/runtime/node/*/stretch.Dockerfile
images/runtime/node/*/strech.Dockerfile
images/runtime/node/*/bullseye.Dockerfile
images/runtime/dotnetcore/*/Dockerfile
images/runtime/dotnetcore/*/buster.Dockerfile
images/runtime/dotnetcore/*/stretch.Dockerfile
images/runtime/dotnetcore/*/bullseye.Dockerfile
images/runtime/dotnetcore/*/bookworm.Dockerfile
images/runtime/python/*/Dockerfile
images/runtime/python/*/buster.Dockerfile
images/runtime/python/*/stretch.Dockerfile
images/runtime/python/*/bullseye.Dockerfile
images/runtime/php/*/Dockerfile
images/runtime/php/*/buster.Dockerfile
images/runtime/php/*/stretch.Dockerfile
images/runtime/php/*/bullseye.Dockerfile
images/runtime/php-fpm/*/Dockerfile
images/runtime/php-fpm/*/buster.Dockerfile
images/runtime/php-fpm/*/stretch.Dockerfile
images/runtime/php-fpm/*/bullseye.Dockerfile
# Go packages from GitHub # Go packages from GitHub
src/startupscriptgenerator/bin/ src/startupscriptgenerator/bin/
src/startupscriptgenerator/src/github.com/ src/startupscriptgenerator/src/github.com/

Просмотреть файл

@ -2,14 +2,6 @@
ENABLE_DYNAMIC_INSTALL_KEY='ENABLE_DYNAMIC_INSTALL' ENABLE_DYNAMIC_INSTALL_KEY='ENABLE_DYNAMIC_INSTALL'
SDK_STORAGE_BASE_URL_KEY_NAME='ORYX_SDK_STORAGE_BASE_URL' SDK_STORAGE_BASE_URL_KEY_NAME='ORYX_SDK_STORAGE_BASE_URL'
TESTING_SDK_STORAGE_URL_KEY_NAME='ORYX_TEST_SDK_STORAGE_URL'
PRIVATE_STAGING_STORAGE_SAS_TOKEN_KEY='ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN'
ORYX_KEYVAULT_URI='https://oryx.vault.azure.net'
STAGING_STORAGE_SAS_TOKEN_KEYVAULT_SECRET_NAME='ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN'
PRIVATE_STAGING_SDK_STORAGE_BASE_URL='https://oryxsdksstaging.blob.core.windows.net'
DEV_SDK_STORAGE_BASE_URL='https://oryxsdksdev.blob.core.windows.net'
SANDBOX_SDK_STORAGE_BASE_URL='https://oryxsdkssandbox.blob.core.windows.net'
PRIVATE_SDK_STORAGE_BASE_URL='https://oryxsdksprivate.blob.core.windows.net'
PROD_SDK_STORAGE_BASE_URL='https://oryxsdksprod.blob.core.windows.net' PROD_SDK_STORAGE_BASE_URL='https://oryxsdksprod.blob.core.windows.net'
PROD_BACKUP_SDK_STORAGE_BASE_URL='https://oryxsdksprodbackup.blob.core.windows.net' PROD_BACKUP_SDK_STORAGE_BASE_URL='https://oryxsdksprodbackup.blob.core.windows.net'
PROD_SDK_CDN_STORAGE_BASE_URL='https://oryx-cdn.microsoft.io' PROD_SDK_CDN_STORAGE_BASE_URL='https://oryx-cdn.microsoft.io'

Просмотреть файл

@ -88,7 +88,6 @@ declare -r BASE_IMAGES_STAGING_REPO="$ACR_DEV_NAME/staging/oryx/base"
# Flag to add information to images through labels (example: build number, commit sha) # Flag to add information to images through labels (example: build number, commit sha)
declare -r EMBED_BUILDCONTEXT_IN_IMAGES="${EMBEDBUILDCONTEXTINIMAGES:-false}" declare -r EMBED_BUILDCONTEXT_IN_IMAGES="${EMBEDBUILDCONTEXTINIMAGES:-false}"
declare -r GIT_COMMIT=$(git rev-parse HEAD)
declare -r DOCKER_SYSTEM_PRUNE="${ORYX_DOCKER_SYSTEM_PRUNE:-false}" declare -r DOCKER_SYSTEM_PRUNE="${ORYX_DOCKER_SYSTEM_PRUNE:-false}"

Просмотреть файл

@ -13,33 +13,38 @@ DEBIAN_FLAVOR_TO_BUILD=$2
SDK_STORAGE_ACCOUNT_URL=$3 SDK_STORAGE_ACCOUNT_URL=$3
platformsDir="$REPO_DIR/platforms" platformsDir="$REPO_DIR/platforms"
# TODO: find a better place for chmod
chmod +x $platformsDir/golang/getGolangSdk.sh
case $PLATFORM_TO_BUILD in case $PLATFORM_TO_BUILD in
'dotnet') 'dotnet')
chmod +x "$platformsDir/dotnet/getDotNetSdk.sh"
"$platformsDir/dotnet/getDotNetSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/dotnet/getDotNetSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'python') 'python')
chmod +x "$platformsDir/python/buildPython.sh"
"$platformsDir/python/buildPython.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/python/buildPython.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'php') 'php')
chmod +x "$platformsDir/php/buildPhp.sh"
"$platformsDir/php/buildPhp.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/php/buildPhp.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'nodejs') 'nodejs')
chmod +x "$platformsDir/nodejs/getNode.sh"
"$platformsDir/nodejs/getNode.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/nodejs/getNode.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'golang') 'golang')
chmod +x "$platformsDir/golang/getGolangSdk.sh"
"$platformsDir/golang/getGolangSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/golang/getGolangSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'ruby') 'ruby')
chmod +x "$platformsDir/ruby/buildRuby.sh"
"$platformsDir/ruby/buildRuby.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/ruby/buildRuby.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'java') 'java')
chmod +x "$platformsDir/java/getJavaSdk.sh"
"$platformsDir/java/getJavaSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/java/getJavaSdk.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
'maven') 'maven')
chmod +x "$platformsDir/java/maven/getMaven.sh"
"$platformsDir/java/maven/getMaven.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL "$platformsDir/java/maven/getMaven.sh" $DEBIAN_FLAVOR_TO_BUILD $SDK_STORAGE_ACCOUNT_URL
;; ;;
*) echo "Unknown image directory";; *) echo "Unknown image directory";;
esac esac

Просмотреть файл

@ -12,201 +12,38 @@ declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd )
source $REPO_DIR/build/__variables.sh source $REPO_DIR/build/__variables.sh
source $REPO_DIR/build/__functions.sh source $REPO_DIR/build/__functions.sh
buildImageDebianFlavor="$1"
buildImageTagFilter=""
if [ -n "$TESTINTEGRATIONCASEFILTER" ];then
IFS='&'
read -a splitArr <<< "$TESTINTEGRATIONCASEFILTER"
for val in "${splitArr[@]}";
do
if [[ "$val" == "build-image="* ]];then
buildImagePrefix="build-image="
strippedVal=${val#"$buildImagePrefix"}
buildImageTagFilter="$strippedVal"
fi
done
fi
if [ -n "$buildImageTagFilter" ];then
echo
echo "Filtering test build images by provided build image tag filter '$buildImageTagFilter'"
fi
echo echo
echo "Building build images for tests..." echo "Building build images for tests..."
# Build GitHub Actions stretch build image
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "github-actions-debian-stretch" ];then
echo "Building stretch based GitHub Action image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-stretch" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-stretch \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo echo "Building buster based GitHub Action image for tests..."
echo docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-buster" \
--build-arg PARENT_IMAGE_BASE=$ORYX_TEST_IMAGE_BASE:github-actions-debian-buster-$IMAGE_BUILDNUMBER \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo "Building image that uses stretch based github action as a base but doesn't have all required environment variables..." echo
docker build \ echo
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-stretch-base" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-stretch \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_BUILDIMAGE_DOCKERFILE" \
.
echo echo "Building bullseye based GitHub Action image for tests..."
echo docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bullseye" \
--build-arg PARENT_IMAGE_BASE=$ORYX_TEST_IMAGE_BASE:github-actions-debian-bullseye-$IMAGE_BUILDNUMBER \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo "Building image that uses stretch based github action as a base and has all required environment variables..." echo
docker build \ echo
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-stretch-base-withenv" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-stretch \
--build-arg DEBIAN_FLAVOR=stretch \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_WITHENV_BUILDIMAGE_DOCKERFILE" \
.
echo echo "Building bookworm based GitHub Action image for tests..."
echo docker build \
fi -t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bookworm" \
--build-arg PARENT_IMAGE_BASE=$ORYX_TEST_IMAGE_BASE:github-actions-debian-bookworm-$IMAGE_BUILDNUMBER \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
# Build GitHub Actions buster build image echo
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "github-actions-debian-buster" ];then echo
echo "Building buster based GitHub Action image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-buster" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-buster \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses buster based github action as a base but doesn't have all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-buster-base" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-buster \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses buster based github action as a base and has all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-buster-base-withenv" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-buster \
--build-arg DEBIAN_FLAVOR=buster \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_WITHENV_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
fi
# Build GitHub Actions bullseye build image and helper build images
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "github-actions-debian-bullseye" ];then
echo "Building bullseye based GitHub Action image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bullseye" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bullseye \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses bullseye based GitHub Action as a base but doesn't have all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bullseye-base" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bullseye \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses bullseye based GitHub Action as a base and has all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bullseye-base-withenv" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bullseye \
--build-arg DEBIAN_FLAVOR=bullseye \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_WITHENV_BUILDIMAGE_DOCKERFILE" \
.
echo
fi
# Build GitHub Actions bookworm build image and helper build images
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "github-actions-debian-bookworm" ];then
echo "Building bookworm based GitHub Action image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bookworm" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bookworm \
-f "$ORYXTESTS_GITHUB_ACTIONS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses bookworm based GitHub Action as a base but doesn't have all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bookworm-base" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bookworm \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
echo "Building image that uses bookworm based GitHub Action as a base and has all required environment variables..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:github-actions-debian-bookworm-base-withenv" \
--build-arg PARENT_IMAGE_BASE=github-actions-debian-bookworm \
--build-arg DEBIAN_FLAVOR=bookworm \
-f "$ORYXTESTS_GITHUB_ACTIONS_ASBASE_WITHENV_BUILDIMAGE_DOCKERFILE" \
.
echo
fi
# Build latest stretch build image
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "debian-stretch" ];then
echo "Building stretch based full build image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:debian-stretch" \
-f "$ORYXTESTS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
fi
# Build LTS versions stretch build image
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "lts-versions-debian-stretch" ];then
echo "Building stretch based LTS versions image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:lts-versions-debian-stretch" \
--build-arg PARENT_IMAGE_BASE=lts-versions-debian-stretch \
-f "$ORYXTESTS_LTS_VERSIONS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
fi
# Build LTS versions buster build image
if [ -z "$buildImageTagFilter" ] || [ "$buildImageTagFilter" == "lts-versions-debian-buster" ];then
echo "Building buster based LTS versions image for tests..."
docker build \
-t "$ORYXTESTS_BUILDIMAGE_REPO:lts-versions-debian-buster" \
--build-arg PARENT_IMAGE_BASE=lts-versions-debian-buster \
-f "$ORYXTESTS_LTS_VERSIONS_BUILDIMAGE_DOCKERFILE" \
.
echo
echo
fi
dockerCleanupIfRequested dockerCleanupIfRequested

Просмотреть файл

@ -14,12 +14,6 @@ declare -r testProjectName="Oryx.BuildImage.Tests"
source $REPO_DIR/build/__variables.sh source $REPO_DIR/build/__variables.sh
source $REPO_DIR/build/__sdkStorageConstants.sh source $REPO_DIR/build/__sdkStorageConstants.sh
if [ -z "$ORYX_TEST_SDK_STORAGE_URL" ]; then
echo
echo "Setting environment variable 'ORYX_TEST_SDK_STORAGE_URL' to default value '$PRIVATE_STAGING_SDK_STORAGE_BASE_URL' for build image tests."
export ORYX_TEST_SDK_STORAGE_URL="$PRIVATE_STAGING_SDK_STORAGE_BASE_URL"
fi
if [ "$1" = "skipBuildingImages" ] if [ "$1" = "skipBuildingImages" ]
then then
echo echo

Просмотреть файл

@ -10,33 +10,6 @@ declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd )
source $REPO_DIR/build/__variables.sh source $REPO_DIR/build/__variables.sh
source $REPO_DIR/build/__sdkStorageConstants.sh source $REPO_DIR/build/__sdkStorageConstants.sh
if [ -z "$ORYX_TEST_SDK_STORAGE_URL" ]; then
echo
echo "Setting environment variable 'ORYX_TEST_SDK_STORAGE_URL' to default value '$PRIVATE_STAGING_SDK_STORAGE_BASE_URL' for integration tests."
export ORYX_TEST_SDK_STORAGE_URL="$PRIVATE_STAGING_SDK_STORAGE_BASE_URL"
fi
# When this script is run in CI agent these environment variables are already set
if [ -z "$SQLSERVER_DATABASE_HOST" ]; then
function getSecretFromKeyVault() {
local secretName="$1"
result=`az.cmd keyvault secret show \
--name "$secretName" \
--vault-name "oryx" \
| grep value \
| awk '{print $NF}' \
| tr -d '"'`
echo $result
}
echo
echo Retrieving secrets from Azure Key Vault...
export SQLSERVER_DATABASE_HOST=$(getSecretFromKeyVault "SQLSERVER-DATABASE-HOST")
export SQLSERVER_DATABASE_NAME=$(getSecretFromKeyVault "SQLSERVER-DATABASE-NAME")
export SQLSERVER_DATABASE_USERNAME=$(getSecretFromKeyVault "SQLSERVER-DATABASE-USERNAME")
export SQLSERVER_DATABASE_PASSWORD=$(getSecretFromKeyVault "SQLSERVER-DATABASE-PASSWORD")
fi
echo echo
# This is needed because when we are running tests in multiple agent machines # This is needed because when we are running tests in multiple agent machines
@ -94,6 +67,7 @@ dotnet test \
$testCaseFilter \ $testCaseFilter \
--test-adapter-path:. \ --test-adapter-path:. \
--logger:"xunit;LogFilePath=$ARTIFACTS_DIR/testResults/$testProjectName$integrationTestPlatform.Tests.xml" \ --logger:"xunit;LogFilePath=$ARTIFACTS_DIR/testResults/$testProjectName$integrationTestPlatform.Tests.xml" \
--verbosity detailed \
-c $BUILD_CONFIGURATION -c $BUILD_CONFIGURATION
# --blame flag generates an xml file which it drops under the project directory. # --blame flag generates an xml file which it drops under the project directory.

Просмотреть файл

@ -14,12 +14,6 @@ declare -r testProjectName="Oryx.RuntimeImage.Tests"
source $REPO_DIR/build/__variables.sh source $REPO_DIR/build/__variables.sh
source $REPO_DIR/build/__sdkStorageConstants.sh source $REPO_DIR/build/__sdkStorageConstants.sh
if [ -z "$ORYX_TEST_SDK_STORAGE_URL" ]; then
echo
echo "Setting environment variable 'ORYX_TEST_SDK_STORAGE_URL' to default value '$PRIVATE_STAGING_SDK_STORAGE_BASE_URL' for runtime image tests."
export ORYX_TEST_SDK_STORAGE_URL="$PRIVATE_STAGING_SDK_STORAGE_BASE_URL"
fi
if [ "$1" = "skipBuildingImages" ] if [ "$1" = "skipBuildingImages" ]
then then
echo echo

Просмотреть файл

@ -13,7 +13,6 @@ namespace Microsoft.Oryx.Automation.Commons
/// <summary> /// <summary>
/// Gets the SDK storage URL by combining the base URL with a platform-specific suffix. /// Gets the SDK storage URL by combining the base URL with a platform-specific suffix.
/// If the base URL is not provided, the default base URL will be used. /// If the base URL is not provided, the default base URL will be used.
/// For the staging account, a SAS token is required and will be appended to the URL.
/// </summary> /// </summary>
/// <param name="oryxSdkStorageBaseUrl">The base URL of the SDK storage.</param> /// <param name="oryxSdkStorageBaseUrl">The base URL of the SDK storage.</param>
/// <param name="platformSuffixUrl">The platform-specific suffix URL.</param> /// <param name="platformSuffixUrl">The platform-specific suffix URL.</param>
@ -27,19 +26,6 @@ namespace Microsoft.Oryx.Automation.Commons
string sdkVersionsUrl = oryxSdkStorageBaseUrl + platformSuffixUrl; string sdkVersionsUrl = oryxSdkStorageBaseUrl + platformSuffixUrl;
// A SAS token is required for the staging account.
if (sdkVersionsUrl.StartsWith(Constants.OryxSdkStagingStorageBaseUrl))
{
string sasToken = Environment.GetEnvironmentVariable(Constants.OryxSdkStagingPrivateSasTokenEnvVar);
if (string.IsNullOrEmpty(sasToken))
{
throw new ArgumentException($"The environment variable {Constants.OryxSdkStagingPrivateSasTokenEnvVar} " +
$"must be provided in order to access {Constants.OryxSdkStagingStorageBaseUrl}");
}
sdkVersionsUrl += "&" + sasToken;
}
return sdkVersionsUrl; return sdkVersionsUrl;
} }

Просмотреть файл

@ -11,7 +11,6 @@ namespace Microsoft.Oryx.Automation
public const string OryxSdkStorageBaseUrl = "https://oryx-cdn.microsoft.io"; public const string OryxSdkStorageBaseUrl = "https://oryx-cdn.microsoft.io";
public const string OryxSdkStagingStorageBaseUrl = "https://oryxsdksstaging.blob.core.windows.net"; public const string OryxSdkStagingStorageBaseUrl = "https://oryxsdksstaging.blob.core.windows.net";
public const string OryxSdkStorageBaseUrlEnvVar = "ORYX_SDK_STORAGE_BASE_URL"; public const string OryxSdkStorageBaseUrlEnvVar = "ORYX_SDK_STORAGE_BASE_URL";
public const string OryxSdkStagingPrivateSasTokenEnvVar = "ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN";
public const string VersionsToBuildTxtFileName = "versionsToBuild.txt"; public const string VersionsToBuildTxtFileName = "versionsToBuild.txt";
public const string ConstantsYaml = "constants.yaml"; public const string ConstantsYaml = "constants.yaml";
public static readonly HashSet<string> DebianFlavors = new HashSet<string>() public static readonly HashSet<string> DebianFlavors = new HashSet<string>()

Просмотреть файл

@ -2,14 +2,6 @@
ENABLE_DYNAMIC_INSTALL_KEY='ENABLE_DYNAMIC_INSTALL' ENABLE_DYNAMIC_INSTALL_KEY='ENABLE_DYNAMIC_INSTALL'
SDK_STORAGE_BASE_URL_KEY_NAME='ORYX_SDK_STORAGE_BASE_URL' SDK_STORAGE_BASE_URL_KEY_NAME='ORYX_SDK_STORAGE_BASE_URL'
TESTING_SDK_STORAGE_URL_KEY_NAME='ORYX_TEST_SDK_STORAGE_URL'
PRIVATE_STAGING_STORAGE_SAS_TOKEN_KEY='ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN'
ORYX_KEYVAULT_URI='https://oryx.vault.azure.net'
STAGING_STORAGE_SAS_TOKEN_KEYVAULT_SECRET_NAME='ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN'
PRIVATE_STAGING_SDK_STORAGE_BASE_URL='https://oryxsdksstaging.blob.core.windows.net'
DEV_SDK_STORAGE_BASE_URL='https://oryxsdksdev.blob.core.windows.net'
SANDBOX_SDK_STORAGE_BASE_URL='https://oryxsdkssandbox.blob.core.windows.net'
PRIVATE_SDK_STORAGE_BASE_URL='https://oryxsdksprivate.blob.core.windows.net'
PROD_SDK_STORAGE_BASE_URL='https://oryxsdksprod.blob.core.windows.net' PROD_SDK_STORAGE_BASE_URL='https://oryxsdksprod.blob.core.windows.net'
PROD_BACKUP_SDK_STORAGE_BASE_URL='https://oryxsdksprodbackup.blob.core.windows.net' PROD_BACKUP_SDK_STORAGE_BASE_URL='https://oryxsdksprodbackup.blob.core.windows.net'
PROD_SDK_CDN_STORAGE_BASE_URL='https://oryx-cdn.microsoft.io' PROD_SDK_CDN_STORAGE_BASE_URL='https://oryx-cdn.microsoft.io'

Просмотреть файл

@ -1,8 +1,15 @@
ARG PARENT_DEBIAN_FLAVOR ARG BASE_IMAGE
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
FROM oryxdevmcr.azurecr.io/public/oryx/cli:${PARENT_DEBIAN_FLAVOR} AS main FROM ${BASE_IMAGE} AS main
COPY --from=oryxdevmcr.azurecr.io/private/oryx/support-files-image-for-build /tmp/oryx/ /tmp ARG IMAGES_DIR=/tmp/images
ARG BUILD_DIR=/tmp/build
RUN mkdir -p ${IMAGES_DIR} \
&& mkdir -p ${BUILD_DIR}
COPY images ${IMAGES_DIR}
COPY build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; \
&& find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR \ ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR \
ORYX_BUILDIMAGE_TYPE="jamstack" \ ORYX_BUILDIMAGE_TYPE="jamstack" \
@ -73,22 +80,23 @@ RUN set -ex \
ARG IMAGES_DIR="/opt/tmp/images" ARG IMAGES_DIR="/opt/tmp/images"
ARG BUILD_DIR="/opt/tmp/build" ARG BUILD_DIR="/opt/tmp/build"
RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ COPY images/yarn-v1.22.15.tar.gz .
set -e \ RUN set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& yarnCacheFolder="/usr/local/share/yarn-cache" \ && yarnCacheFolder="/usr/local/share/yarn-cache" \
&& mkdir -p $yarnCacheFolder \ && mkdir -p $yarnCacheFolder \
&& chmod 777 $yarnCacheFolder \ && chmod 777 $yarnCacheFolder \
&& . ${BUILD_DIR}/__nodeVersions.sh \
&& if [ "${DEBIAN_FLAVOR}" == "bullseye" || "${DEBIAN_FLAVOR}" == "buster" ]; then ${IMAGES_DIR}/installPlatform.sh nodejs ${NODE16_VERSION}; fi \
&& ${IMAGES_DIR}/receiveGpgKeys.sh 6A010C5166006599AA17F08146C2130DFD2497F5 \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \ && mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn \ && tar -xzf yarn-v1.22.15.tar.gz -C /opt/yarn \
&& mv /opt/yarn/yarn-v$YARN_VERSION /opt/yarn/$YARN_VERSION \ && mv /opt/yarn/yarn-v1.22.15 /opt/yarn/1.22.15 \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz && rm yarn-v1.22.15.tar.gz
COPY nodejs-${DEBIAN_FLAVOR}-16.20.0.tar.gz .
RUN set -e \
&& mkdir -p /opt/nodejs/16.20.0 \
&& tar -xzf nodejs-${DEBIAN_FLAVOR}-16.20.0.tar.gz -C /usr/local \
&& rm nodejs-${DEBIAN_FLAVOR}-16.20.0.tar.gz \
&& ln -sfn "/opt/nodejs/16.20.0" "/opt/nodejs/16.20"
RUN set -ex \ RUN set -ex \
&& . ${BUILD_DIR}/__nodeVersions.sh \ && . ${BUILD_DIR}/__nodeVersions.sh \
&& ln -s $YARN_VERSION /opt/yarn/stable \ && ln -s $YARN_VERSION /opt/yarn/stable \
@ -99,9 +107,11 @@ RUN set -ex \
&& mkdir -p /links \ && mkdir -p /links \
&& cp -s /opt/yarn/stable/bin/yarn /opt/yarn/stable/bin/yarnpkg /links && cp -s /opt/yarn/stable/bin/yarn /opt/yarn/stable/bin/yarnpkg /links
RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ ARG PYTHON38_VERSION
set -e \ ENV PYTHON38_VERSION ${PYTHON38_VERSION}
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \ COPY python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz .
RUN set -e \
# Install Python SDKs # Install Python SDKs
# Upgrade system python # Upgrade system python
&& PYTHONIOENCODING="UTF-8" \ && PYTHONIOENCODING="UTF-8" \
@ -113,8 +123,9 @@ RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
&& pip3 install pip --upgrade \ && pip3 install pip --upgrade \
&& pip install --upgrade cython \ && pip install --upgrade cython \
&& pip3 install --upgrade cython \ && pip3 install --upgrade cython \
&& . $buildDir/__pythonVersions.sh \ && mkdir -p /opt/python/${PYTHON38_VERSION} \
&& $imagesDir/installPlatform.sh python $PYTHON38_VERSION \ && tar -xzf python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz -C /opt/python/${PYTHON38_VERSION} \
&& rm python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz \
&& [ -d "/opt/python/$PYTHON38_VERSION" ] && echo /opt/python/$PYTHON38_VERSION/lib >> /etc/ld.so.conf.d/python.conf \ && [ -d "/opt/python/$PYTHON38_VERSION" ] && echo /opt/python/$PYTHON38_VERSION/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \ && ldconfig \
&& cd /opt/python \ && cd /opt/python \

Просмотреть файл

@ -3,7 +3,7 @@ ARG DEBIAN_FLAVOR
# Use the curl flavor of buildpack-deps as the base image, which is lighter than the standard flavor; more information here: https://hub.docker.com/_/buildpack-deps # Use the curl flavor of buildpack-deps as the base image, which is lighter than the standard flavor; more information here: https://hub.docker.com/_/buildpack-deps
FROM buildpack-deps:${DEBIAN_FLAVOR}-curl as main FROM buildpack-deps:${DEBIAN_FLAVOR}-curl as main
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ARG SDK_STORAGE_BASE_URL_VALUE="https://oryx-cdn.microsoft.io" ARG SDK_STORAGE_BASE_URL_VALUE
ARG AI_CONNECTION_STRING ARG AI_CONNECTION_STRING
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
@ -14,8 +14,33 @@ RUN if [ "${DEBIAN_FLAVOR}" = "stretch" ]; then \
&& sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \ && sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \
fi fi
COPY --from=oryxdevmcr.azurecr.io/private/oryx/buildscriptgenerator /opt/buildscriptgen/ /opt/buildscriptgen/ ## Build Script Generator
COPY --from=oryxdevmcr.azurecr.io/private/oryx/support-files-image-for-build /tmp/oryx/ /opt/tmp ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
WORKDIR /usr/oryx
COPY build build
# This statement copies signed oryx binaries from during agent build.
# For local/dev contents of blank/empty directory named binaries are getting copied
COPY binaries /opt/buildscriptgen/
COPY src src
COPY build/FinalPublicKey.snk build/
RUN chmod a+x /opt/buildscriptgen/GenerateBuildScript
RUN chmod a+x /opt/buildscriptgen/Microsoft.Oryx.BuildServer
ARG IMAGES_DIR=/opt/tmp/images
ARG BUILD_DIR=/opt/tmp/build
RUN mkdir -p ${IMAGES_DIR} \
&& mkdir -p ${BUILD_DIR}
COPY images ${IMAGES_DIR}
COPY build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; \
&& find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} \ ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} \
ENABLE_DYNAMIC_INSTALL="true" \ ENABLE_DYNAMIC_INSTALL="true" \

Просмотреть файл

@ -3,7 +3,7 @@ ARG DEBIAN_FLAVOR
# Use the curl flavor of buildpack-deps as the base image, which is lighter than the standard flavor; more information here: https://hub.docker.com/_/buildpack-deps # Use the curl flavor of buildpack-deps as the base image, which is lighter than the standard flavor; more information here: https://hub.docker.com/_/buildpack-deps
FROM buildpack-deps:${DEBIAN_FLAVOR}-curl as main FROM buildpack-deps:${DEBIAN_FLAVOR}-curl as main
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ARG SDK_STORAGE_BASE_URL_VALUE="https://oryx-cdn.microsoft.io" ARG SDK_STORAGE_BASE_URL_VALUE
ARG AI_CONNECTION_STRING ARG AI_CONNECTION_STRING
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
@ -14,8 +14,34 @@ RUN if [ "${DEBIAN_FLAVOR}" = "stretch" ]; then \
&& sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \ && sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \
fi fi
COPY --from=oryxdevmcr.azurecr.io/private/oryx/buildscriptgenerator /opt/buildscriptgen/ /opt/buildscriptgen/ ## Build Script Generator
COPY --from=oryxdevmcr.azurecr.io/private/oryx/support-files-image-for-build /tmp/oryx/ /opt/tmp ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
WORKDIR /usr/oryx
COPY build build
# This statement copies signed oryx binaries from during agent build.
# For local/dev contents of blank/empty directory named binaries are getting copied
COPY binaries /opt/buildscriptgen/
COPY src src
COPY build/FinalPublicKey.snk build/
RUN chmod a+x /opt/buildscriptgen/GenerateBuildScript
RUN chmod a+x /opt/buildscriptgen/Microsoft.Oryx.BuildServer
ARG IMAGES_DIR=/opt/tmp/images
ARG BUILD_DIR=/opt/tmp/build
RUN mkdir -p ${IMAGES_DIR} \
&& mkdir -p ${BUILD_DIR}
COPY images ${IMAGES_DIR}
COPY build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; \
&& find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} \ ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} \
ENABLE_DYNAMIC_INSTALL="true" \ ENABLE_DYNAMIC_INSTALL="true" \
@ -92,19 +118,17 @@ RUN apt-get update \
ARG BUILD_DIR="/opt/tmp/build" ARG BUILD_DIR="/opt/tmp/build"
ARG IMAGES_DIR="/opt/tmp/images" ARG IMAGES_DIR="/opt/tmp/images"
RUN ${IMAGES_DIR}/build/installHugo.sh RUN ${IMAGES_DIR}/build/installHugo.sh
COPY images/yarn-v1.22.15.tar.gz .
RUN set -ex \ RUN set -ex \
&& yarnCacheFolder="/usr/local/share/yarn-cache" \ && yarnCacheFolder="/usr/local/share/yarn-cache" \
&& mkdir -p $yarnCacheFolder \ && mkdir -p $yarnCacheFolder \
&& chmod 777 $yarnCacheFolder \ && chmod 777 $yarnCacheFolder \
&& . ${BUILD_DIR}/__nodeVersions.sh \ && . ${BUILD_DIR}/__nodeVersions.sh \
&& ${IMAGES_DIR}/receiveGpgKeys.sh 6A010C5166006599AA17F08146C2130DFD2497F5 \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \ && mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn \ && tar -xzf yarn-v1.22.15.tar.gz -C /opt/yarn \
&& mv /opt/yarn/yarn-v$YARN_VERSION /opt/yarn/$YARN_VERSION \ && mv /opt/yarn/yarn-v1.22.15 /opt/yarn/1.22.15 \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz && rm yarn-v1.22.15.tar.gz
RUN set -ex \ RUN set -ex \
&& . ${BUILD_DIR}/__nodeVersions.sh \ && . ${BUILD_DIR}/__nodeVersions.sh \
&& ln -s $YARN_VERSION /opt/yarn/stable \ && ln -s $YARN_VERSION /opt/yarn/stable \
@ -136,10 +160,11 @@ RUN set -ex \
uuid-dev \ uuid-dev \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ARG PYTHON38_VERSION
ENV PYTHON38_VERSION ${PYTHON38_VERSION}
COPY python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz .
# Install Python 3.8 to use in some .NET and node applications # Install Python 3.8 to use in some .NET and node applications
RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ RUN set -e \
set -e \
&& export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \
&& tmpDir="/opt/tmp" \ && tmpDir="/opt/tmp" \
&& imagesDir="$tmpDir/images" \ && imagesDir="$tmpDir/images" \
&& buildDir="$tmpDir/build" \ && buildDir="$tmpDir/build" \
@ -152,8 +177,9 @@ RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
&& pip3 install pip --upgrade \ && pip3 install pip --upgrade \
&& pip install --upgrade cython \ && pip install --upgrade cython \
&& pip3 install --upgrade cython \ && pip3 install --upgrade cython \
&& . $buildDir/__pythonVersions.sh \ && mkdir -p /opt/python/${PYTHON38_VERSION} \
&& $imagesDir/installPlatform.sh python $PYTHON38_VERSION \ && tar -xzf python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz -C /opt/python/${PYTHON38_VERSION} \
&& rm python-${DEBIAN_FLAVOR}-${PYTHON38_VERSION}.tar.gz \
&& [ -d "/opt/python/$PYTHON38_VERSION" ] && echo /opt/python/$PYTHON38_VERSION/lib >> /etc/ld.so.conf.d/python.conf \ && [ -d "/opt/python/$PYTHON38_VERSION" ] && echo /opt/python/$PYTHON38_VERSION/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \ && ldconfig \
&& cd /opt/python \ && cd /opt/python \

Просмотреть файл

@ -15,20 +15,45 @@ ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER} ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME} ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR} ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR}
RUN ./build.sh golang /opt/startupcmdgen/golang RUN chmod +x build.sh && ./build.sh golang /opt/startupcmdgen/golang
### oryx build image ### oryx build image
FROM buildpack-deps:${DEBIAN_FLAVOR}-curl FROM buildpack-deps:${DEBIAN_FLAVOR}-curl
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ARG SDK_STORAGE_BASE_URL_VALUE="https://oryx-cdn.microsoft.io" ARG SDK_STORAGE_BASE_URL_VALUE
ARG AI_CONNECTION_STRING ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING} ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE}
# docker multi-stage builds ARG IMAGES_DIR=/opt/tmp/images
COPY --from=oryxdevmcr.azurecr.io/private/oryx/support-files-image-for-build /tmp/oryx/ /opt/tmp ARG BUILD_DIR=/opt/tmp/build
COPY --from=oryxdevmcr.azurecr.io/private/oryx/buildscriptgenerator /opt/ /opt/ RUN mkdir -p ${IMAGES_DIR} \
&& mkdir -p ${BUILD_DIR}
COPY images ${IMAGES_DIR}
COPY build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; \
&& find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
WORKDIR /usr/oryx
COPY build build
# This statement copies signed oryx binaries from during agent build.
# For local/dev contents of blank/empty directory named binaries are getting copied
COPY binaries /opt/buildscriptgen/
COPY src src
COPY build/FinalPublicKey.snk build/
RUN chmod a+x /opt/buildscriptgen/GenerateBuildScript
RUN chmod a+x /opt/buildscriptgen/Microsoft.Oryx.BuildServer
COPY --from=startupScriptGens /opt/startupcmdgen/ /opt/startupcmdgen/ COPY --from=startupScriptGens /opt/startupcmdgen/ /opt/startupcmdgen/
RUN if [ "${DEBIAN_FLAVOR}" = "bullseye" ]; then \ RUN if [ "${DEBIAN_FLAVOR}" = "bullseye" ]; then \

Просмотреть файл

@ -1,5 +1,27 @@
ARG DEBIAN_FLAVOR ARG BASE_IMAGE
FROM oryxdevmcr.azurecr.io/private/oryx/githubrunners-buildpackdeps-${DEBIAN_FLAVOR} AS main
FROM mcr.microsoft.com/dotnet/sdk:7.0 as buildscriptgenerator
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
WORKDIR /usr/oryx
COPY build build
# This statement copies signed oryx binaries from during agent build.
# For local/dev contents of blank/empty directory named binaries are getting copied
COPY binaries /opt/buildscriptgen/
COPY src src
COPY build/FinalPublicKey.snk build/
RUN chmod a+x /opt/buildscriptgen/GenerateBuildScript
RUN chmod a+x /opt/buildscriptgen/Microsoft.Oryx.BuildServer
FROM ${BASE_IMAGE} AS main
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
@ -102,24 +124,31 @@ RUN if [ "${DEBIAN_FLAVOR}" = "bookworm" ]; then \
# Install Yarn, HUGO # Install Yarn, HUGO
FROM main AS intermediate FROM main AS intermediate
COPY --from=oryxdevmcr.azurecr.io/private/oryx/support-files-image-for-build /tmp/oryx/ /opt/tmp
COPY --from=oryxdevmcr.azurecr.io/private/oryx/buildscriptgenerator /opt/buildscriptgen/ /opt/buildscriptgen/ ARG IMAGES_DIR=/opt/tmp/images
ARG BUILD_DIR="/opt/tmp/build" ARG BUILD_DIR=/opt/tmp/build
ARG IMAGES_DIR="/opt/tmp/images" RUN mkdir -p ${IMAGES_DIR} \
&& mkdir -p ${BUILD_DIR}
COPY images ${IMAGES_DIR}
COPY build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; \
&& find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
COPY --from=buildscriptgenerator /opt/buildscriptgen/ /opt/buildscriptgen/
RUN ${IMAGES_DIR}/build/installHugo.sh RUN ${IMAGES_DIR}/build/installHugo.sh
COPY images/yarn-v1.22.15.tar.gz .
RUN set -ex \ RUN set -ex \
&& yarnCacheFolder="/usr/local/share/yarn-cache" \ && yarnCacheFolder="/usr/local/share/yarn-cache" \
&& mkdir -p $yarnCacheFolder \ && mkdir -p $yarnCacheFolder \
&& chmod 777 $yarnCacheFolder \ && chmod 777 $yarnCacheFolder \
&& . ${BUILD_DIR}/__nodeVersions.sh \ && . ${BUILD_DIR}/__nodeVersions.sh \
&& ${IMAGES_DIR}/receiveGpgKeys.sh 6A010C5166006599AA17F08146C2130DFD2497F5 \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& ${IMAGES_DIR}/retry.sh "curl -fsSLO --compressed https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \ && mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn \ && tar -xzf yarn-v1.22.15.tar.gz -C /opt/yarn \
&& mv /opt/yarn/yarn-v$YARN_VERSION /opt/yarn/$YARN_VERSION \ && mv /opt/yarn/yarn-v1.22.15 /opt/yarn/1.22.15 \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz && rm yarn-v1.22.15.tar.gz
RUN set -ex \ RUN set -ex \
&& . ${BUILD_DIR}/__nodeVersions.sh \ && . ${BUILD_DIR}/__nodeVersions.sh \
&& ln -s $YARN_VERSION /opt/yarn/stable \ && ln -s $YARN_VERSION /opt/yarn/stable \

Просмотреть файл

@ -1,5 +1,5 @@
ARG DEBIAN_FLAVOR ARG BASE_IMAGE
FROM oryxdevmcr.azurecr.io/private/oryx/oryx-run-base-${DEBIAN_FLAVOR} FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images ARG IMAGES_DIR=/tmp/oryx/images
RUN apt-get update \ RUN apt-get update \
@ -15,13 +15,10 @@ RUN apt-get update \
RUN ${IMAGES_DIR}/receiveGpgKeys.sh \ RUN ${IMAGES_DIR}/receiveGpgKeys.sh \
6A010C5166006599AA17F08146C2130DFD2497F5 6A010C5166006599AA17F08146C2130DFD2497F5
ENV YARN_VERSION 1.22.15 COPY images/yarn-v1.22.15.tar.gz .
RUN curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ RUN mkdir -p /opt \
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && tar -xzf yarn-v1.22.15.tar.gz -C /opt/ \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && ln -s /opt/yarn-v1.22.15/bin/yarn /usr/local/bin/yarn \
&& mkdir -p /opt \ && ln -s /opt/yarn-v1.22.15/bin/yarnpkg /usr/local/bin/yarnpkg \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \ && rm yarn-v1.22.15.tar.gz
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz

Просмотреть файл

@ -0,0 +1,71 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# prevent Debian's PHP packages from being installed
# https://github.com/docker-library/php/pull/542
RUN set -eux; \
{ \
echo 'Package: php*'; \
echo 'Pin: release *'; \
echo 'Pin-Priority: -1'; \
} > /etc/apt/preferences.d/no-debian-php
# dependencies required for running "phpize"
# (see persistent deps below)
ENV PHPIZE_DEPS \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c
# persistent / runtime deps
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
$PHPIZE_DEPS \
ca-certificates \
curl \
xz-utils \
libzip-dev \
libpng-dev \
libjpeg-dev \
libpq-dev \
libldap2-dev \
libldb-dev \
libicu-dev \
libgmp-dev \
libmagickwand-dev \
libc-client-dev \
libtidy-dev \
libkrb5-dev \
libxslt-dev \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
mariadb-client \
openssl \
libedit-dev \
libsodium-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libonig-dev \
libcurl4-openssl-dev \
libldap2-dev \
zlib1g-dev \
apache2-dev \
libsqlite3-dev \
; \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& ACCEPT_EULA=Y \
DEBIAN_FRONTEND=noninteractive \
apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,71 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# prevent Debian's PHP packages from being installed
# https://github.com/docker-library/php/pull/542
RUN set -eux; \
{ \
echo 'Package: php*'; \
echo 'Pin: release *'; \
echo 'Pin-Priority: -1'; \
} > /etc/apt/preferences.d/no-debian-php
# dependencies required for running "phpize"
# (see persistent deps below)
ENV PHPIZE_DEPS \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c
# persistent / runtime deps
RUN set -eux; \
apt-get update; \
apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
$PHPIZE_DEPS \
ca-certificates \
curl \
xz-utils \
libzip-dev \
libpng-dev \
libjpeg-dev \
libpq-dev \
libldap2-dev \
libldb-dev \
libicu-dev \
libgmp-dev \
libmagickwand-dev \
libc-client-dev \
libtidy-dev \
libkrb5-dev \
libxslt-dev \
openssh-server \
vim \
wget \
tcptraceroute \
mariadb-client \
openssl \
libedit-dev \
libsodium-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libonig-dev \
libcurl4-openssl-dev \
libldap2-dev \
zlib1g-dev \
apache2-dev \
libsqlite3-dev \
; \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& ACCEPT_EULA=Y \
DEBIAN_FRONTEND=noninteractive \
apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,104 @@
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image
# and copy them to our final runtime image
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS tools-install
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-gcdump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-monitor --version 7.*
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh dotnetcore /opt/startupcmdgen/startupcmdgen
FROM mcr.microsoft.com/mirror/docker/library/debian:bullseye-slim
ARG BUILD_DIR=/tmp/oryx/build
ADD build ${BUILD_DIR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
\
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu67 \
libssl1.1 \
libstdc++6 \
zlib1g \
lldb \
curl \
file \
libgdiplus \
&& apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*
# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
PATH="/opt/dotnetcore-tools:${PATH}"
COPY --from=tools-install /dotnetcore-tools /opt/dotnetcore-tools
# Install .NET Core
RUN set -ex \
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Runtime/$NET_CORE_APP_60/dotnet-runtime-$NET_CORE_APP_60-linux-x64.tar.gz \
&& echo "$NET_CORE_APP_60_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
# Install ASP.NET Core
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_CORE_APP_60/aspnetcore-runtime-$ASPNET_CORE_APP_60-linux-x64.tar.gz \
&& echo "$ASPNET_CORE_APP_60_SHA aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \
&& rm aspnetcore.tar.gz \
&& dotnet-sos install \
&& rm -rf ${BUILD_DIR}
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ARG USER_DOTNET_AI_VERSION
ENV USER_DOTNET_AI_VERSION=${USER_DOTNET_AI_VERSION}
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
ENV DOTNET_VERSION=%DOTNET_VERSION%
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# 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
COPY DotNetCoreAgent.${USER_DOTNET_AI_VERSION}.zip /DotNetCoreAgent/appinsights.zip
RUN set -e \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& apt-get update \
&& apt-get install unzip -y \
&& apt-get upgrade --assume-yes \
&& cd DotNetCoreAgent \
&& unzip appinsights.zip && rm appinsights.zip

Просмотреть файл

@ -0,0 +1,108 @@
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image
# and copy them to our final runtime image
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS tools-install
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-gcdump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-monitor --version 7.*
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh dotnetcore /opt/startupcmdgen/startupcmdgen
FROM mcr.microsoft.com/mirror/docker/library/debian:buster-slim
ARG BUILD_DIR=/tmp/oryx/build
ADD build ${BUILD_DIR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu63 \
libssl1.1 \
libstdc++6 \
zlib1g \
lldb \
curl \
file \
libgdiplus \
&& apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*
# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
PATH="/opt/dotnetcore-tools:${PATH}"
COPY --from=tools-install /dotnetcore-tools /opt/dotnetcore-tools
# Install .NET Core
RUN set -ex \
# based on resolution on https://github.com/NuGet/Announcements/issues/49#issue-795386700
&& apt-get remove ca-certificates -y \
&& apt-get purge ca-certificates -y \
&& apt-get update \
&& apt-get install -f ca-certificates=20200601~deb10u2 -y --no-install-recommends \
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Runtime/$NET_CORE_APP_60/dotnet-runtime-$NET_CORE_APP_60-linux-x64.tar.gz \
&& echo "$NET_CORE_APP_60_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
# Install ASP.NET Core
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_CORE_APP_60/aspnetcore-runtime-$ASPNET_CORE_APP_60-linux-x64.tar.gz \
&& echo "$ASPNET_CORE_APP_60_SHA aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \
&& rm aspnetcore.tar.gz \
&& dotnet-sos install \
&& rm -rf ${BUILD_DIR}
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ARG USER_DOTNET_AI_VERSION
ENV USER_DOTNET_AI_VERSION=${USER_DOTNET_AI_VERSION}
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
ENV DOTNET_VERSION=%DOTNET_VERSION%
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# 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
COPY DotNetCoreAgent.${USER_DOTNET_AI_VERSION}.zip /DotNetCoreAgent/appinsights.zip
RUN set -e \
&& echo $USER_DOTNET_AI_VERSION \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& apt-get update \
&& apt-get install unzip -y \
&& apt-get upgrade --assume-yes \
&& cd DotNetCoreAgent \
&& unzip appinsights.zip && rm appinsights.zip

Просмотреть файл

@ -0,0 +1,108 @@
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image
# and copy them to our final runtime image
FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS tools-install
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-gcdump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-monitor --version 8.*
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bookworm 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 chmod +x build.sh && ./build.sh dotnetcore /opt/startupcmdgen/startupcmdgen
FROM mcr.microsoft.com/mirror/docker/library/debian:bookworm-slim
ARG BUILD_DIR=/tmp/oryx/build
ADD build ${BUILD_DIR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu72 \
libssl3 \
libstdc++6 \
zlib1g \
lldb \
curl \
file \
libgdiplus \
&& apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*
# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
PATH="/opt/dotnetcore-tools:${PATH}"
COPY --from=tools-install /dotnetcore-tools /opt/dotnetcore-tools
# Install .NET Core
RUN set -ex \
# based on resolution on https://github.com/NuGet/Announcements/issues/49#issue-795386700
&& apt-get remove ca-certificates -y \
&& apt-get purge ca-certificates -y \
&& apt-get update \
&& apt-get install -f ca-certificates -y --no-install-recommends \
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Runtime/$NET_CORE_APP_80/dotnet-runtime-$NET_CORE_APP_80-linux-x64.tar.gz \
&& echo "$NET_CORE_APP_80_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
# Install ASP.NET Core
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_CORE_APP_80/aspnetcore-runtime-$ASPNET_CORE_APP_80-linux-x64.tar.gz \
&& echo "$ASPNET_CORE_APP_80_SHA aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \
&& rm aspnetcore.tar.gz \
&& dotnet-sos install \
&& rm -rf ${BUILD_DIR}
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ARG USER_DOTNET_AI_VERSION
ENV USER_DOTNET_AI_VERSION=${USER_DOTNET_AI_VERSION}
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
ENV DOTNET_VERSION=%DOTNET_VERSION%
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# 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
COPY DotNetCoreAgent.${USER_DOTNET_AI_VERSION}.zip /DotNetCoreAgent/appinsights.zip
RUN set -e \
&& echo $USER_DOTNET_AI_VERSION \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& apt-get update \
&& apt-get install unzip -y \
&& apt-get upgrade --assume-yes \
&& cd DotNetCoreAgent \
&& unzip appinsights.zip && rm appinsights.zip

Просмотреть файл

@ -0,0 +1,107 @@
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image
# and copy them to our final runtime image
FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS tools-install
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-gcdump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-monitor --version 8.*
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh dotnetcore /opt/startupcmdgen/startupcmdgen
FROM mcr.microsoft.com/mirror/docker/library/debian:bullseye-slim
ARG BUILD_DIR=/tmp/oryx/build
ADD build ${BUILD_DIR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu67 \
libssl1.1 \
libstdc++6 \
zlib1g \
lldb \
curl \
file \
libgdiplus \
&& apt-get upgrade --assume-yes \
&& rm -rf /var/lib/apt/lists/*
# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
PATH="/opt/dotnetcore-tools:${PATH}"
COPY --from=tools-install /dotnetcore-tools /opt/dotnetcore-tools
# Install .NET Core
RUN set -ex \
# based on resolution on https://github.com/NuGet/Announcements/issues/49#issue-795386700
&& apt-get remove ca-certificates -y \
&& apt-get purge ca-certificates -y \
&& apt-get update \
&& apt-get install -f ca-certificates -y --no-install-recommends \
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Runtime/$NET_CORE_APP_80/dotnet-runtime-$NET_CORE_APP_80-linux-x64.tar.gz \
&& echo "$NET_CORE_APP_80_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
# Install ASP.NET Core
&& . ${BUILD_DIR}/__dotNetCoreRunTimeVersions.sh \
&& curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_CORE_APP_80/aspnetcore-runtime-$ASPNET_CORE_APP_80-linux-x64.tar.gz \
&& echo "$ASPNET_CORE_APP_80_SHA aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \
&& rm aspnetcore.tar.gz \
&& dotnet-sos install \
&& rm -rf ${BUILD_DIR}
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ARG USER_DOTNET_AI_VERSION
ENV USER_DOTNET_AI_VERSION=${USER_DOTNET_AI_VERSION}
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
ENV DOTNET_VERSION=%DOTNET_VERSION%
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# 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
COPY DotNetCoreAgent.${USER_DOTNET_AI_VERSION}.zip /DotNetCoreAgent/appinsights.zip
RUN set -e \
&& echo $USER_DOTNET_AI_VERSION \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& apt-get update \
&& apt-get install unzip -y \
&& apt-get upgrade --assume-yes \
&& cd DotNetCoreAgent \
&& unzip appinsights.zip && rm appinsights.zip

Просмотреть файл

@ -0,0 +1,75 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh node /opt/startupcmdgen/startupcmdgen
#FROM oryxdevmcr.azurecr.io/private/oryx/oryx-node-run-base-bullseye:${BUILD_NUMBER}
FROM ${BASE_IMAGE}
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 NODE18_VERSION
ENV NODE_VERSION ${NODE18_VERSION}
ENV NPM_CONFIG_LOGLEVEL info
ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
COPY nodejs-bullseye-${NODE18_VERSION}.tar.gz .
RUN set -e \
&& mkdir -p /opt/nodejs/${NODE18_VERSION} \
&& tar -xzf nodejs-bullseye-${NODE18_VERSION}.tar.gz -C /usr/local \
&& rm nodejs-bullseye-${NODE18_VERSION}.tar.gz \
&& 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
# 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"
CMD [ "node" ]

Просмотреть файл

@ -1,6 +1,7 @@
ARG DEBIAN_FLAVOR ARG BASE_IMAGE
# Startup script generator # Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bookworm as startupCmdGen
# GOPATH is set to "/go" in the base image # GOPATH is set to "/go" in the base image
WORKDIR /go/src WORKDIR /go/src
@ -11,9 +12,41 @@ ARG RELEASE_TAG_NAME=unspecified
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME} ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV GIT_COMMIT=${GIT_COMMIT} ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER} ENV BUILD_NUMBER=${BUILD_NUMBER}
RUN ./build.sh node /opt/startupcmdgen/startupcmdgen RUN chmod +x build.sh && ./build.sh node /opt/startupcmdgen/startupcmdgen
FROM mcr.microsoft.com/oryx/base:node-20-debian-bookworm-20240221.3 #FROM oryxdevmcr.azurecr.io/private/oryx/oryx-node-run-base-bookworm:${BUILD_NUMBER}
FROM ${BASE_IMAGE}
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
ENV NODE_VERSION ${NODE20_VERSION}
ENV NPM_CONFIG_LOGLEVEL info
ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
COPY nodejs-bookworm-${NODE20_VERSION}.tar.gz .
RUN set -e \
&& mkdir -p /opt/nodejs/${NODE20_VERSION} \
&& tar -xzf nodejs-bookworm-${NODE20_VERSION}.tar.gz -C /usr/local \
&& rm nodejs-bookworm-${NODE20_VERSION}.tar.gz \
&& 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
# Bake Application Insights key from pipeline variable into final image # Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING ARG AI_CONNECTION_STRING
@ -36,4 +69,8 @@ RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
ENV LANG="C.UTF-8" \ ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \ LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8" LC_ALL="C.UTF-8"
CMD [ "node" ]

Просмотреть файл

@ -0,0 +1,76 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh node /opt/startupcmdgen/startupcmdgen
#FROM oryxdevmcr.azurecr.io/private/oryx/oryx-node-run-base-bullseye:${BUILD_NUMBER}
FROM ${BASE_IMAGE}
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
ENV NODE_VERSION ${NODE20_VERSION}
ENV NPM_CONFIG_LOGLEVEL info
ARG BUILD_DIR=/tmp/oryx/build
ARG IMAGES_DIR=/tmp/oryx/images
COPY nodejs-bullseye-${NODE20_VERSION}.tar.gz .
RUN set -e \
&& mkdir -p /opt/nodejs/${NODE20_VERSION} \
&& tar -xzf nodejs-bullseye-${NODE20_VERSION}.tar.gz -C /usr/local \
&& rm nodejs-bullseye-${NODE20_VERSION}.tar.gz \
&& 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
# 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"
CMD [ "node" ]

4
images/runtime/php-fpm/.gitignore поставляемый
Просмотреть файл

@ -1,4 +0,0 @@
Dockerfile
buster.Dockerfile
base.Dockerfile
base.Buster.Dockerfile

Просмотреть файл

@ -0,0 +1,437 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD
ENV PHP_VERSION 8.1.27
ENV PHP_URL="https://www.php.net/get/php-8.1.27.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.1.27.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="479e65c3f05714d4aace1370e617d78e49e996ec7a7579a5be47535be61f0658" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.1/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.1/docker-php-ext-* images/runtime/php-fpm/8.1/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,439 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD
ENV PHP_VERSION 8.1.27
ENV PHP_URL="https://www.php.net/get/php-8.1.27.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.1.27.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="479e65c3f05714d4aace1370e617d78e49e996ec7a7579a5be47535be61f0658" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.1/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.1/docker-php-ext-* images/runtime/php-fpm/8.1/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
## dockerfile
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,436 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A
ENV PHP_VERSION 8.2.17
ENV PHP_URL="https://www.php.net/get/php-8.2.17.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.2.17.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="1cc4ef733ba58f6557db648012471f1916e5bac316303aa165535bedab08ee35" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.2/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.2/docker-php-ext-* images/runtime/php-fpm/8.2/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,436 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A
ENV PHP_VERSION 8.2.17
ENV PHP_URL="https://www.php.net/get/php-8.2.17.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.2.17.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="1cc4ef733ba58f6557db648012471f1916e5bac316303aa165535bedab08ee35" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.2/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.2/docker-php-ext-* images/runtime/php-fpm/8.2/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,432 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bookworm 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null;
COPY images/runtime/php-fpm/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.3/docker-php-ext-* images/runtime/php-fpm/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockefile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
## dockerfile
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,438 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.3/docker-php-ext-* images/runtime/php-fpm/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
## dockerfile
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,438 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# do NOT merge this content with above line because the
# above line is shared across all php images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php-fpm/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
#which docker-php-source; \
awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \
cat /usr/local/bin/docker-php-source_new; \
chmod +x /usr/local/bin/docker-php-source_new ; \
docker-php-source_new extract; \
ls -l /usr/src/; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source_new delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php-fpm/8.3/docker-php-ext-* images/runtime/php-fpm/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-*
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
WORKDIR /var/www/html
RUN set -eux; \
cd /usr/local/etc; \
if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
} | tee php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
RUN rm -rf /var/lib/apt/lists/*
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# 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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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"
## dockerfile
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

2
images/runtime/php/.gitignore поставляемый
Просмотреть файл

@ -1,2 +0,0 @@
Dockerfile
base.Dockerfile

Просмотреть файл

@ -0,0 +1,462 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
#FROM oryxdevmcr.azurecr.io/private/oryx/php-run-base-bullseye:{BUILD_NUMBER}
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD
ENV PHP_VERSION 8.1.27
ENV PHP_URL="https://www.php.net/get/php-8.1.27.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.1.27.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="479e65c3f05714d4aace1370e617d78e49e996ec7a7579a5be47535be61f0658" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.1/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.1/docker-php-ext-* images/runtime/php/8.1/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.1/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
## dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,464 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
#FROM oryxdevmcr.azurecr.io/private/oryx/php-run-base-buster:${BUILD_NUMBER}
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD
ENV PHP_VERSION 8.1.27
ENV PHP_URL="https://www.php.net/get/php-8.1.27.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.1.27.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="479e65c3f05714d4aace1370e617d78e49e996ec7a7579a5be47535be61f0658" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.1/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.1/docker-php-ext-* images/runtime/php/8.1/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.1/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
## dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,461 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A
ENV PHP_VERSION 8.2.17
ENV PHP_URL="https://www.php.net/get/php-8.2.17.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.2.17.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="1cc4ef733ba58f6557db648012471f1916e5bac316303aa165535bedab08ee35" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.2/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.2/docker-php-ext-* images/runtime/php/8.2/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.2/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,460 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-buster 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A
ENV PHP_VERSION 8.2.17
ENV PHP_URL="https://www.php.net/get/php-8.2.17.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.2.17.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="1cc4ef733ba58f6557db648012471f1916e5bac316303aa165535bedab08ee35" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.2/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.2/docker-php-ext-* images/runtime/php/8.2/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.2/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,461 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bookworm 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
#apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
#\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.3/docker-php-ext-* images/runtime/php/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.3/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,461 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.3/docker-php-ext-* images/runtime/php/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.3/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -0,0 +1,462 @@
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-bullseye 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 chmod +x build.sh && ./build.sh php /opt/startupcmdgen/startupcmdgen
# From https://github.com/docker-library/php.git
FROM ${BASE_IMAGE}
ARG IMAGES_DIR=/tmp/oryx/images
# 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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg2 \
apt-transport-https \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
[ ! -d /var/www/html ]; \
mkdir -p /var/www/html; \
chown www-data:www-data /var/www/html; \
chmod 777 /var/www/html
##<autogenerated>##
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends apache2; \
rm -rf /var/lib/apt/lists/*; \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
\
# setup directories and permissions
. "$APACHE_ENVVARS"; \
for dir in \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
; do \
rm -rvf "$dir"; \
mkdir -p "$dir"; \
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
chmod 777 "$dir"; \
done; \
\
# delete the "index.html" that installing Apache drops in here
rm -rvf /var/www/html/*; \
\
# logs should go to stdout / stderr
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \
echo '\tSetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
echo; \
echo 'DirectoryIndex disabled'; \
echo 'DirectoryIndex index.php index.html'; \
echo; \
echo '<Directory /var/www/>'; \
echo '\tOptions -Indexes'; \
echo '\tAllowOverride All'; \
echo '</Directory>'; \
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
&& a2enconf docker-php
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no
##</autogenerated>##
# Apply stack smash protection to functions using local buffers and alloca()
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
# Enable optimization (-O2)
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
# https://github.com/docker-library/php/issues/272
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4
ENV PHP_VERSION 8.3.4
ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5=""
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
\
mkdir -p /usr/src; \
cd /usr/src; \
\
curl -fsSL -o php.tar.xz "$PHP_URL"; \
\
if [ -n "$PHP_SHA256" ]; then \
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
fi; \
if [ -n "$PHP_MD5" ]; then \
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
fi; \
\
if [ -n "$PHP_ASC_URL" ]; then \
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
export GNUPGHOME="$(mktemp -d)"; \
${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
COPY images/runtime/php/8.3/docker-php-source /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-source
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; \
rm -rf /var/lib/apt/lists/*; \
\
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-source extract; \
cd /usr/src/php; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors intead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494
--with-pear \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
\
${PHP_EXTRA_CONFIGURE_ARGS:-} \
; \
make -j "$(nproc)"; \
find -type f -name '*.a' -delete; \
make install; \
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
make clean; \
\
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
cp -v php.ini-* "$PHP_INI_DIR/"; \
\
cd /; \
docker-php-source delete; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
# smoke test
php --version
COPY images/runtime/php/8.3/docker-php-ext-* images/runtime/php/8.3/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-*
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
RUN docker-php-ext-enable sodium \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["docker-php-entrypoint"]
##<autogenerated>##
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
COPY images/runtime/php/8.3/apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##
## base dockerfile
SHELL ["/bin/bash", "-c"]
ARG PHP_VERSION
ENV PHP_VERSION ${PHP_VERSION}
RUN a2enmod rewrite expires include deflate remoteip headers
ENV APACHE_RUN_USER www-data
# Edit the default DocumentRoot setting
ENV APACHE_DOCUMENT_ROOT /home/site/wwwroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Edit the default port setting
ENV APACHE_PORT 8080
RUN sed -ri -e 's!<VirtualHost \*:80>!<VirtualHost *:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!<VirtualHost _default_:443>!<VirtualHost _default_:${APACHE_PORT}>!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!Listen 80!Listen ${APACHE_PORT}!g' /etc/apache2/ports.conf
# Edit Configuration to instruct Apache on how to process PHP files
RUN echo -e '<FilesMatch "\.(?i:ph([[p]?[0-9]*|tm[l]?))$">\n SetHandler application/x-httpd-php\n</FilesMatch>' >> /etc/apache2/apache2.conf
# Disable Apache2 server signature
RUN echo -e 'ServerSignature Off' >> /etc/apache2/apache2.conf
RUN echo -e 'ServerTokens Prod' >> /etc/apache2/apache2.conf
RUN { \
echo '<DirectoryMatch "^/.*/\.git/">'; \
echo ' Order deny,allow'; \
echo ' Deny from all'; \
echo '</DirectoryMatch>'; \
} >> /etc/apache2/apache2.conf
# 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.* || $PHP_VERSION == 8.3.* ]]; 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
# wddx \
# xmlrpc \
xsl
RUN set -eux; \
if [[ $PHP_VERSION != 5.* ]]; then \
pecl install redis && docker-php-ext-enable redis; \
fi
# https://github.com/Imagick/imagick/issues/331
# https://github.com/ihneo/php/pull/24/files
RUN set -eux; \
if [[ $PHP_VERSION != 8.3.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# deprecated from 5.*, so should be avoided
RUN set -eux; \
if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \
echo "pecl/mongodb requires PHP (version >= 7.1.0, version <= 7.99.99)"; \
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
# For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0
RUN set -eux; \
if [[ $PHP_VERSION == 8.0.* ]]; then \
pecl install sqlsrv-5.11.0 pdo_sqlsrv-5.11.0 \
&& 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
# Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0)
RUN set -eux; \
if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; 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/*
RUN rm -rf /tmp/oryx
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"
# dockerfile
# 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
RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \
&& rm -rf /tmp/oryx \
# Temporarily making sure apache2-foreground has permission
&& chmod +x /usr/local/bin/apache2-foreground
ENV LANG="C.UTF-8" \
LANGUAGE="C.UTF-8" \
LC_ALL="C.UTF-8"

Просмотреть файл

@ -1,4 +1,6 @@
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ARG BASE_IMAGE
# Startup script generator # Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen
# GOPATH is set to "/go" in the base image # GOPATH is set to "/go" in the base image
@ -12,13 +14,15 @@ ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER} ENV BUILD_NUMBER=${BUILD_NUMBER}
#Bake in client certificate path into image to avoid downloading it #Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt" ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
RUN ./build.sh python /opt/startupcmdgen/startupcmdgen RUN chmod +x build.sh && ./build.sh python /opt/startupcmdgen/startupcmdgen
FROM ${BASE_IMAGE} as main
FROM oryxdevmcr.azurecr.io/private/oryx/%BASE_TAG% as main
ARG DEBIAN_FLAVOR
ARG IMAGES_DIR=/tmp/oryx/images ARG IMAGES_DIR=/tmp/oryx/images
ARG BUILD_DIR=/tmp/oryx/build ARG BUILD_DIR=/tmp/oryx/build
ARG SDK_STORAGE_BASE_URL_VALUE ARG SDK_STORAGE_BASE_URL_VALUE
ARG DEBIAN_FLAVOR
ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR} ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR}
ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE}
@ -35,7 +39,11 @@ ADD build ${BUILD_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \; RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ENV PYTHON_VERSION %PYTHON_FULL_VERSION% ARG PYTHON_FULL_VERSION
ARG PYTHON_VERSION
ARG PYTHON_MAJOR_VERSION
ENV PYTHON_VERSION ${PYTHON_FULL_VERSION}
RUN true RUN true
COPY build/__pythonVersions.sh ${BUILD_DIR} COPY build/__pythonVersions.sh ${BUILD_DIR}
RUN true RUN true
@ -58,17 +66,17 @@ RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \
RUN set -ex \ RUN set -ex \
&& cd /opt/python/ \ && cd /opt/python/ \
&& ln -s %PYTHON_FULL_VERSION% %PYTHON_VERSION% \ && ln -s ${PYTHON_FULL_VERSION} ${PYTHON_VERSION} \
&& ln -s %PYTHON_VERSION% %PYTHON_MAJOR_VERSION% \ && ln -s ${PYTHON_VERSION} ${PYTHON_MAJOR_VERSION} \
&& echo /opt/python/%PYTHON_MAJOR_VERSION%/lib >> /etc/ld.so.conf.d/python.conf \ && echo /opt/python/${PYTHON_MAJOR_VERSION}/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \ && ldconfig \
&& if [ "%PYTHON_MAJOR_VERSION%" = "3" ]; then cd /opt/python/%PYTHON_MAJOR_VERSION%/bin \ && if [ "${PYTHON_MAJOR_VERSION}" = "3" ]; then cd /opt/python/${PYTHON_MAJOR_VERSION}/bin \
&& ln -nsf idle3 idle \ && ln -nsf idle3 idle \
&& ln -nsf pydoc3 pydoc \ && ln -nsf pydoc3 pydoc \
&& ln -nsf python3-config python-config; fi \ && ln -nsf python3-config python-config; fi \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/python/%PYTHON_MAJOR_VERSION%/bin:${PATH}" ENV PATH="/opt/python/${PYTHON_MAJOR_VERSION}/bin:${PATH}"
# Bake Application Insights key from pipeline variable into final image # Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING ARG AI_CONNECTION_STRING
@ -87,8 +95,8 @@ RUN pip install --upgrade pip \
&& pip install viztracer==0.15.6 \ && pip install viztracer==0.15.6 \
&& pip install vizplugins==0.1.3 \ && pip install vizplugins==0.1.3 \
# Removing orjson only for 3.12 due to build errors # Removing orjson only for 3.12 due to build errors
&& if [ "%PYTHON_VERSION%" != "3.12" ] && [ "%PYTHON_VERSION%" != "3.7" ]; then pip install orjson==3.10.1; fi \ && if [ "${PYTHON_VERSION}" != "3.12" ] && [ "${PYTHON_VERSION}" != "3.7" ]; then pip install orjson==3.10.1; fi \
&& if [ "%PYTHON_VERSION%" = "3.7" ] || [ "%PYTHON_VERSION%" = "3.8" ]; then curl -LO http://ftp.de.debian.org/debian/pool/main/libf/libffi/libffi6_3.2.1-9_amd64.deb \ && if [ "${PYTHON_VERSION}" = "3.7" ] || [ "${PYTHON_VERSION}" = "3.8" ]; then curl -LO http://ftp.de.debian.org/debian/pool/main/libf/libffi/libffi6_3.2.1-9_amd64.deb \
&& dpkg -i libffi6_3.2.1-9_amd64.deb \ && dpkg -i libffi6_3.2.1-9_amd64.deb \
&& rm libffi6_3.2.1-9_amd64.deb; fi \ && rm libffi6_3.2.1-9_amd64.deb; fi \
&& ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \ && ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \

Двоичные данные
images/yarn-v1.22.15.tar.gz Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -17,21 +17,15 @@ blobExists() {
local containerName="$1" local containerName="$1"
local blobName="$2" local blobName="$2"
local sdkStorageAccountUrl="$3" local sdkStorageAccountUrl="$3"
local inStorageAccountFile="$REPO_DIR/platforms/${containerName//-//}/versions/inStorageAccount.txt"
local exitCode=1 local exitCode=1
sasToken=""
if [ "$sdkStorageAccountUrl" == "$PRIVATE_STAGING_SDK_STORAGE_BASE_URL" ]; then echo "Checking if blob exists..."
set +x if grep "$blobName" "$inStorageAccountFile"; then
sasToken=$ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN echo "Exists in storage account"
set -x
fi
curl -I $sdkStorageAccountUrl/$containerName/$blobName$sasToken 2> /tmp/curlError.txt 1> /tmp/curlOut.txt
grep "HTTP/1.1 200 OK" /tmp/curlOut.txt &> /dev/null
exitCode=$?
rm -f /tmp/curlOut.txt
rm -f /tmp/curlError.txt
if [ $exitCode -eq 0 ]; then
return 0 return 0
else else
echo "Does not exist in storage account"
return 1 return 1
fi fi
} }
@ -129,8 +123,8 @@ shouldOverwritePlatformSdk() {
} }
isDefaultVersionFile() { isDefaultVersionFile() {
$blobName="$1" blobName="$1"
if [[ "$blobName" == "defaultVersion"* ]]; then if [[ $blobName == defaultVersion* ]]; then
return 0 return 0
else else
return 1 return 1

Просмотреть файл

@ -15,6 +15,14 @@ RUN apt-get update \
jq \ jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://git.io/n-install | bash -s -- -ny - RUN curl -sL https://git.io/n-install | bash -s -- -ny -
RUN mkdir -p /tmp/scripts RUN mkdir -p /tmp/scripts
COPY platforms/nodejs/build.sh /tmp/scripts COPY platforms/nodejs/build.sh /tmp/scripts
RUN chmod +x /tmp/scripts/build.sh RUN chmod +x /tmp/scripts/build.sh
COPY platforms /tmp/platforms
COPY build /tmp/build
RUN chmod +x /tmp/platforms/**/*.sh
RUN chmod +x /tmp/build/**/*.sh
RUN mkdir /tmp/sdk
RUN /tmp/platforms/nodejs/getNode.sh ${DEBIAN_FLAVOR} ""

Просмотреть файл

@ -42,6 +42,5 @@ upgradeNpm() {
~/n/bin/n -d $version ~/n/bin/n -d $version
upgradeNpm $version upgradeNpm $version
cd /usr/local/n/versions/node/$version cd /usr/local/n/versions/node/$version
mkdir -p /tmp/compressedSdk mkdir -p /tmp/compressedSdk/nodejs
tar -zcf /tmp/compressedSdk/$tarFileName . tar -zcf /tmp/compressedSdk/nodejs/$tarFileName .
rm -rf /usr/local/n ~/n

Просмотреть файл

@ -6,17 +6,17 @@
set -ex set -ex
declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && cd .. && pwd ) declare -r REPO_DIR="/tmp"
source $REPO_DIR/platforms/__common.sh source $REPO_DIR/platforms/__common.sh
nodePlatformDir="$REPO_DIR/platforms/nodejs" nodePlatformDir="$REPO_DIR/platforms/nodejs"
hostNodeArtifactsDir="$volumeHostDir/nodejs" outputDir="/tmp/compressedSdk/nodejs"
debianFlavor="$1" debianFlavor="$1"
sdkStorageAccountUrl="$2" sdkStorageAccountUrl="$2"
mkdir -p "$hostNodeArtifactsDir"
builtNodeImage=false mkdir -p "$outputDir"
getNode() { getNode() {
local version="$1" local version="$1"
@ -27,14 +27,14 @@ getNode() {
if [ "$debianFlavor" == "stretch" ]; then if [ "$debianFlavor" == "stretch" ]; then
# Use default sdk file name # Use default sdk file name
tarFileName=nodejs-$version.tar.gz tarFileName=nodejs-$version.tar.gz
metadataFile="$hostNodeArtifactsDir/nodejs-$version-metadata.txt" metadataFile="$outputDir/nodejs-$version-metadata.txt"
# Continue adding the version metadata with the name of Version # Continue adding the version metadata with the name of Version
# which is what our legacy CLI will use # which is what our legacy CLI will use
sdkVersionMetadataName="$LEGACY_SDK_VERSION_METADATA_NAME" sdkVersionMetadataName="$LEGACY_SDK_VERSION_METADATA_NAME"
cp "$nodePlatformDir/versions/$debianFlavor/defaultVersion.txt" "$hostNodeArtifactsDir/defaultVersion.txt" cp "$nodePlatformDir/versions/$debianFlavor/defaultVersion.txt" "$outputDir/defaultVersion.txt"
else else
tarFileName=nodejs-$debianFlavor-$version.tar.gz tarFileName=nodejs-$debianFlavor-$version.tar.gz
metadataFile="$hostNodeArtifactsDir/nodejs-$debianFlavor-$version-metadata.txt" metadataFile="$outputDir/nodejs-$debianFlavor-$version-metadata.txt"
sdkVersionMetadataName="$SDK_VERSION_METADATA_NAME" sdkVersionMetadataName="$SDK_VERSION_METADATA_NAME"
fi fi
@ -42,19 +42,7 @@ getNode() {
echo "Getting Node version '$version'..." echo "Getting Node version '$version'..."
echo echo
if ! $builtNodeImage; then /tmp/scripts/build.sh $version
docker build \
--build-arg DEBIAN_FLAVOR=$debianFlavor \
-f "$nodePlatformDir/Dockerfile" \
-t $imageName \
$REPO_DIR
builtNodeImage=true
fi
docker run \
-v /$hostNodeArtifactsDir:$volumeContainerDir \
$imageName \
bash -c "/tmp/scripts/build.sh $version && cp -f /tmp/compressedSdk/* /tmp/sdk"
echo "$sdkVersionMetadataName=$version" >> $metadataFile echo "$sdkVersionMetadataName=$version" >> $metadataFile
echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile
@ -66,4 +54,4 @@ echo
buildPlatform "$nodePlatformDir/versions/$debianFlavor/versionsToBuild.txt" getNode buildPlatform "$nodePlatformDir/versions/$debianFlavor/versionsToBuild.txt" getNode
# Write the default version # Write the default version
cp "$nodePlatformDir/versions/$debianFlavor/defaultVersion.txt" "$hostNodeArtifactsDir/defaultVersion.$debianFlavor.txt" cp "$nodePlatformDir/versions/$debianFlavor/defaultVersion.txt" "$outputDir/defaultVersion.$debianFlavor.txt"

Просмотреть файл

@ -1,11 +1,49 @@
FROM oryxdevmcr.azurecr.io/private/oryx/php-build-prereqs AS php73-build ARG DEBIAN_FLAVOR
ARG PHP_VERSION FROM mcr.microsoft.com/mirror/docker/library/buildpack-deps:${DEBIAN_FLAVOR} AS php-buildpack-prereqs
ARG GPG_KEYS
ARG PHP_SHA256
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
COPY platforms/php/prereqs /php
COPY build/__phpVersions.sh /php/
COPY platforms/php/prereqs/build.sh /tmp/
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN PHP_VERSION=$PHP_VERSION \ RUN if [ "${DEBIAN_FLAVOR}" = "stretch" ]; then \
GPG_KEYS=$GPG_KEYS \ sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch-updates/# deb http:\/\/deb.debian.org\/debian stretch-updates/g' /etc/apt/sources.list \
PHP_SHA256=$PHP_SHA256 \ && sed -i 's/^deb http:\/\/security.debian.org\/debian-security stretch/deb http:\/\/archive.debian.org\/debian-security stretch/g' /etc/apt/sources.list \
/php/build.sh && sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \
fi
RUN chmod +x /tmp/*.sh && chmod +x /php/*.sh
RUN if [ "${DEBIAN_FLAVOR}" = "buster" ]; then \
apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
$PHPIZE_DEPS \
ca-certificates \
curl \
xz-utils \
libsodium-dev \
libncurses5 \
--no-install-recommends && rm -r /var/lib/apt/lists/* ; \
else \
export DEBIAN_FLAVOR=${DEBIAN_FLAVOR} ; \
. /php/installPrereqs.sh ; \
fi
COPY platforms /tmp/platforms
COPY build /tmp/build
RUN chmod +x /tmp/platforms/**/*.sh
RUN chmod +x /tmp/build/**/*.sh
RUN mkdir /tmp/sdk
RUN /tmp/platforms/php/buildPhp.sh ${DEBIAN_FLAVOR} "" "php"
# ARG PHP_VERSION
# ARG GPG_KEYS
# ARG PHP_SHA256
# ARG DEBIAN_FLAVOR
# ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
# RUN PHP_VERSION=$PHP_VERSION \
# GPG_KEYS=$GPG_KEYS \
# PHP_SHA256=$PHP_SHA256 \
# /php/build.sh

Просмотреть файл

@ -12,27 +12,15 @@ source $REPO_DIR/platforms/__common.sh
source $REPO_DIR/build/__phpVersions.sh source $REPO_DIR/build/__phpVersions.sh
debianFlavor=$1 debianFlavor=$1
sdkStorageAccountUrl="$2" sdkStorageAccountUrl="$2"
phpType=$3
phpPlatformDir="$REPO_DIR/platforms/php" phpPlatformDir="$REPO_DIR/platforms/php"
builtPhpPrereqs=false
buildPhpPrereqsImage() {
if ! $builtPhpPrereqs; then
echo "Building Php pre-requisites image..."
echo
docker build \
--build-arg DEBIAN_FLAVOR=$debianFlavor \
-f "$phpPlatformDir/prereqs/Dockerfile" \
-t "oryxdevmcr.azurecr.io/private/oryx/php-build-prereqs" $REPO_DIR
builtPhpPrereqs=true
fi
}
buildPhp() { buildPhp() {
local version="$1" local version="$1"
local sha="$2" local sha="$2"
local gpgKeys="$3" local gpgKeys="$3"
local imageName="oryx/php-sdk" local imageName="oryx/php-sdk"
local targetDir="$volumeHostDir/php" local targetDir="/tmp/compressedSdk/php"
local phpSdkFileName="" local phpSdkFileName=""
local metadataFile="" local metadataFile=""
local sdkVersionMetadataName="" local sdkVersionMetadataName=""
@ -56,22 +44,21 @@ buildPhp() {
cp "$phpPlatformDir/versions/$debianFlavor/defaultVersion.txt" "$targetDir/defaultVersion.$debianFlavor.txt" cp "$phpPlatformDir/versions/$debianFlavor/defaultVersion.txt" "$targetDir/defaultVersion.$debianFlavor.txt"
if shouldBuildSdk php $phpSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk php; then if shouldBuildSdk php $phpSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk php; then
if ! $builtPhpPrereqs; then
buildPhpPrereqsImage
fi
echo "Building Php version '$version' in a docker image..." echo "Building Php version '$version' in a docker image..."
echo echo
docker build \ PHP_VERSION=$version GPG_KEYS=$gpgKeys PHP_SHA256=$sha /php/build.sh
-f "$phpPlatformDir/Dockerfile" \
--build-arg PHP_VERSION=$version \
--build-arg PHP_SHA256=$sha \
--build-arg GPG_KEYS="$gpgKeys" \
-t $imageName \
$REPO_DIR
getSdkFromImage $imageName "$targetDir" rm -r /opt/php/*
# docker build \
# -f "$phpPlatformDir/Dockerfile" \
# --build-arg PHP_VERSION=$version \
# --build-arg PHP_SHA256=$sha \
# --build-arg GPG_KEYS="$gpgKeys" \
# -t $imageName \
# $REPO_DIR
echo "$sdkVersionMetadataName=$version" >> $metadataFile echo "$sdkVersionMetadataName=$version" >> $metadataFile
echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile
@ -82,7 +69,7 @@ buildPhpComposer() {
local version="$1" local version="$1"
local sha="$2" local sha="$2"
local imageName="oryx/php-composer-sdk" local imageName="oryx/php-composer-sdk"
local targetDir="$volumeHostDir/php-composer" local targetDir="/tmp/compressedSdk/php-composer"
local composerSdkFileName="php-composer-$version.tar.gz" local composerSdkFileName="php-composer-$version.tar.gz"
local metadataFile="" local metadataFile=""
local sdkVersionMetadataName="" local sdkVersionMetadataName=""
@ -105,39 +92,55 @@ buildPhpComposer() {
fi fi
if shouldBuildSdk php-composer $composerSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk php-composer; then if shouldBuildSdk php-composer $composerSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk php-composer; then
if ! $builtPhpPrereqs; then
buildPhpPrereqsImage
fi
echo "Php composer version '$version' not present in blob storage. Building it in a docker image..." echo "Php composer version '$version' not present in blob storage. Building it in a docker image..."
echo echo
PHP_VERSION=$PHP81_VERSION GPG_KEYS=$PHP81_KEYS PHP_SHA256=$PHP81_TAR_SHA256 /php/build.sh
# Installing PHP composer requires having PHP installed in an first image first, so we try installing # Installing PHP composer requires having PHP installed in an first image first, so we try installing
# a version here. # a version here.
docker build \ # docker build \
-f "$phpPlatformDir/composer/Dockerfile" \ # -f "$phpPlatformDir/composer/Dockerfile" \
--build-arg PHP_VERSION="$PHP81_VERSION" \ # --build-arg PHP_VERSION="$PHP81_VERSION" \
--build-arg DEBIAN_FLAVOR=$debianFlavor \ # --build-arg DEBIAN_FLAVOR=$debianFlavor \
--build-arg PHP_SHA256="$PHP81_TAR_SHA256" \ # --build-arg PHP_SHA256="$PHP81_TAR_SHA256" \
--build-arg GPG_KEYS="$PHP81_KEYS" \ # --build-arg GPG_KEYS="$PHP81_KEYS" \
--build-arg COMPOSER_VERSION="$version" \ # --build-arg COMPOSER_VERSION="$version" \
--build-arg COMPOSER_SETUP_SHA384="$COMPOSER_SETUP_SHA384" \ # --build-arg COMPOSER_SETUP_SHA384="$COMPOSER_SETUP_SHA384" \
-t $imageName \ # -t $imageName \
$REPO_DIR # $REPO_DIR
set -ex
composerDir="/opt/php-composer/$version"
mkdir -p "$composerDir"
export phpbin="/opt/php/$PHP81_VERSION/bin/php"
$phpbin /tmp/platforms/php/composer-setup.php --version=$version --install-dir="$composerDir"
compressedSdkDir="/tmp/compressedSdk/php-composer"
mkdir -p "$compressedSdkDir"
cd "$composerDir"
echo 'debian flavor is: $debianFlavor'
composerSdkFile="php-composer-$debianFlavor-$version.tar.gz"
if [ "$debianFlavor" = "stretch" ]; then
echo 'somehow debian flavor is: $debianFlavor'
composerSdkFile="php-composer-$version.tar.gz"
fi;
tar -zcf "$compressedSdkDir/$composerSdkFile" .
rm -r ./*
rm -r /opt/php/*
getSdkFromImage $imageName "$targetDir"
echo "$sdkVersionMetadataName=$version" >> $metadataFile echo "$sdkVersionMetadataName=$version" >> $metadataFile
echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile
fi fi
} }
echo "Building Php..." if [ "$phpType" == "php" ]; then
echo echo "Building Php..."
buildPlatform "$phpPlatformDir/versions/$debianFlavor/versionsToBuild.txt" buildPhp echo
buildPlatform "$phpPlatformDir/versions/$debianFlavor/versionsToBuild.txt" buildPhp
echo else
echo "Building Php composer..." echo "Building Php composer..."
echo echo
buildPlatform "$phpPlatformDir/composer/versions/$debianFlavor/versionsToBuild.txt" buildPhpComposer buildPlatform "$phpPlatformDir/composer/versions/$debianFlavor/versionsToBuild.txt" buildPhpComposer
fi

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,32 +1,70 @@
FROM oryxdevmcr.azurecr.io/private/oryx/php-build-prereqs ARG DEBIAN_FLAVOR
ARG PHP_VERSION FROM mcr.microsoft.com/mirror/docker/library/buildpack-deps:${DEBIAN_FLAVOR} AS php-buildpack-prereqs
ARG GPG_KEYS
ARG PHP_SHA256
ARG COMPOSER_VERSION
ARG COMPOSER_SETUP_SHA384
ARG DEBIAN_FLAVOR ARG DEBIAN_FLAVOR
ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
RUN PHP_VERSION=$PHP_VERSION \ COPY platforms/php/prereqs /php
GPG_KEYS=$GPG_KEYS \ COPY build/__phpVersions.sh /php/
PHP_SHA256=$PHP_SHA256 \ COPY platforms/php/prereqs/build.sh /tmp/
/php/build.sh COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN set -eux; \ RUN if [ "${DEBIAN_FLAVOR}" = "stretch" ]; then \
composerDir="/opt/php-composer"; \ sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch-updates/# deb http:\/\/deb.debian.org\/debian stretch-updates/g' /etc/apt/sources.list \
mkdir -p "$composerDir"; \ && sed -i 's/^deb http:\/\/security.debian.org\/debian-security stretch/deb http:\/\/archive.debian.org\/debian-security stretch/g' /etc/apt/sources.list \
export phpbin="/opt/php/$PHP_VERSION/bin/php" ; \ && sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \
$phpbin -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ; \ fi
$phpbin -r "if (hash_file('sha384', 'composer-setup.php') === '$COMPOSER_SETUP_SHA384') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" ; \
$phpbin composer-setup.php --version=$COMPOSER_VERSION --install-dir="$composerDir" ; \ RUN chmod +x /tmp/*.sh && chmod +x /php/*.sh
$phpbin -r "unlink('composer-setup.php');" ; \ RUN if [ "${DEBIAN_FLAVOR}" = "buster" ]; then \
compressedSdkDir="/tmp/compressedSdk"; \ apt-get update \
mkdir -p "$compressedSdkDir"; \ && apt-get upgrade -y \
cd "$composerDir"; \ && apt-get install -y \
echo 'debian flavor is: $DEBIAN_FLAVOR' ; \ $PHPIZE_DEPS \
composerSdkFile="php-composer-$DEBIAN_FLAVOR-$COMPOSER_VERSION.tar.gz"; \ ca-certificates \
if [ "$DEBIAN_FLAVOR" = "stretch" ]; then \ curl \
echo 'somehow debian flavor is: $DEBIAN_FLAVOR'; \ xz-utils \
composerSdkFile="php-composer-$COMPOSER_VERSION.tar.gz"; \ libsodium-dev \
fi; \ libncurses5 \
tar -zcf "$compressedSdkDir/$composerSdkFile" . --no-install-recommends && rm -r /var/lib/apt/lists/* ; \
else \
export DEBIAN_FLAVOR=${DEBIAN_FLAVOR} ; \
. /php/installPrereqs.sh ; \
fi
COPY platforms /tmp/platforms
COPY build /tmp/build
RUN chmod +x /tmp/platforms/**/*.sh
RUN chmod +x /tmp/build/**/*.sh
RUN mkdir /tmp/sdk
RUN /tmp/platforms/php/buildPhp.sh ${DEBIAN_FLAVOR} "" "php-composer"
# ARG PHP_VERSION
# ARG GPG_KEYS
# ARG PHP_SHA256
# ARG COMPOSER_VERSION
# ARG COMPOSER_SETUP_SHA384
# ARG DEBIAN_FLAVOR
# ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
# RUN PHP_VERSION=$PHP_VERSION \
# GPG_KEYS=$GPG_KEYS \
# PHP_SHA256=$PHP_SHA256 \
# /php/build.sh
# RUN set -eux; \
# composerDir="/opt/php-composer"; \
# mkdir -p "$composerDir"; \
# export phpbin="/opt/php/$PHP_VERSION/bin/php" ; \
# $phpbin -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ; \
# $phpbin -r "if (hash_file('sha384', 'composer-setup.php') === '$COMPOSER_SETUP_SHA384') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" ; \
# $phpbin composer-setup.php --version=$COMPOSER_VERSION --install-dir="$composerDir" ; \
# $phpbin -r "unlink('composer-setup.php');" ; \
# compressedSdkDir="/tmp/compressedSdk"; \
# mkdir -p "$compressedSdkDir"; \
# cd "$composerDir"; \
# echo 'debian flavor is: $DEBIAN_FLAVOR' ; \
# composerSdkFile="php-composer-$DEBIAN_FLAVOR-$COMPOSER_VERSION.tar.gz"; \
# if [ "$DEBIAN_FLAVOR" = "stretch" ]; then \
# echo 'somehow debian flavor is: $DEBIAN_FLAVOR'; \
# composerSdkFile="php-composer-$COMPOSER_VERSION.tar.gz"; \
# fi; \
# tar -zcf "$compressedSdkDir/$composerSdkFile" .

Просмотреть файл

@ -116,10 +116,13 @@ export \
cd $PHP_SRC_DIR; cd $PHP_SRC_DIR;
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)";
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)";
# https://bugs.php.net/bug.php?id=74125
if [ ! -d /usr/include/curl ]; then # Only needed for php 7.1 and also the following has an error. It checks for /usr/include/curl and links to /usr/local/include/curl.
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; # In a way it never worked!!
fi; # # https://bugs.php.net/bug.php?id=74125
# if [ ! -d /usr/include/curl ]; then
# ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl;
# fi;
versionConfigureArgs='' versionConfigureArgs=''
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+;
@ -195,7 +198,7 @@ if [[ $PHP_VERSION == 7.2.* || $PHP_VERSION == 7.3.* || $PHP_VERSION == 7.4.* ||
&& /php/docker-php-ext-enable.sh mysqlnd_azure; \ && /php/docker-php-ext-enable.sh mysqlnd_azure; \
fi fi
compressedSdkDir="/tmp/compressedSdk" compressedSdkDir="/tmp/compressedSdk/php"
mkdir -p $compressedSdkDir mkdir -p $compressedSdkDir
cd "$INSTALLATION_PREFIX" cd "$INSTALLATION_PREFIX"
tar -zcf $compressedSdkDir/$phpSdkFileName . tar -zcf $compressedSdkDir/$phpSdkFileName .

Просмотреть файл

@ -1,9 +1,38 @@
FROM oryxdevmcr.azurecr.io/private/oryx/python-build-prereqs # Install Python build prerequisites
WORKDIR /usr/src/python ARG DEBIAN_FLAVOR
ARG VERSION_TO_BUILD FROM mcr.microsoft.com/mirror/docker/library/buildpack-deps:${DEBIAN_FLAVOR}
ARG GPG_KEYS ARG DEBIAN_FLAVOR
ARG PIP_VERSION ENV DEBIAN_FLAVOR=$DEBIAN_FLAVOR
RUN PYTHON_VERSION=$VERSION_TO_BUILD \
GPG_KEY=$GPG_KEYS \ COPY build/__pythonVersions.sh /tmp/
PIP_VERSION=$PIP_VERSION \
/tmp/build.sh COPY platforms/python/prereqs/build.sh /tmp/
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN chmod +x /tmp/receiveGpgKeys.sh
# stretch was removed from security.debian.org and deb.debian.org, so update the sources to point to the archived mirror
RUN if [ "${DEBIAN_FLAVOR}" = "stretch" ]; then \
sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch-updates/# deb http:\/\/deb.debian.org\/debian stretch-updates/g' /etc/apt/sources.list \
&& sed -i 's/^deb http:\/\/security.debian.org\/debian-security stretch/deb http:\/\/archive.debian.org\/debian-security stretch/g' /etc/apt/sources.list \
&& sed -i 's/^deb http:\/\/deb.debian.org\/debian stretch/deb http:\/\/archive.debian.org\/debian stretch/g' /etc/apt/sources.list ; \
fi
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
COPY platforms /tmp/platforms
COPY build /tmp/build
RUN chmod +x /tmp/platforms/**/*.sh
RUN chmod +x /tmp/build/**/*.sh
RUN mkdir /tmp/sdk
RUN /tmp/platforms/python/buildPython.sh ${DEBIAN_FLAVOR} ""
# RUN PYTHON_VERSION=$VERSION_TO_BUILD \
# GPG_KEY=$GPG_KEYS \
# PIP_VERSION=$PIP_VERSION \
# /tmp/build.sh

Просмотреть файл

@ -12,46 +12,11 @@ source $REPO_DIR/platforms/__common.sh
source $REPO_DIR/build/__pythonVersions.sh source $REPO_DIR/build/__pythonVersions.sh
pythonPlatformDir="$REPO_DIR/platforms/python" pythonPlatformDir="$REPO_DIR/platforms/python"
targetDir="$volumeHostDir/python" targetDir="/tmp/compressedSdk/python"
debianFlavor=$1 debianFlavor=$1
sdkStorageAccountUrl="$2" sdkStorageAccountUrl="$2"
mkdir -p "$targetDir" mkdir -p "$targetDir"
builtPythonPrereqs=false
builtPythonHackPrereqs=false
buildPythonPrereqsImage() {
debianType=$debianFlavor
# stretch is out of support for python, but we still need to build stretch based
# binaries because of static sites, they need to move to buster based jamstack image
# before we can remove this hack
IFS='.' read -ra SPLIT_VERSION <<< "$version"
if [ "$debianFlavor" == "stretch" ] \
&& [ "${SPLIT_VERSION[0]}" == "3" ] \
&& [ "${SPLIT_VERSION[1]}" -ge "10" ]; then
if ! $builtPythonHackPrereqs; then
debianType="focal-scm"
echo "Building Python hack pre-requisites image..."
echo
docker build \
--build-arg DEBIAN_FLAVOR=$debianFlavor \
--build-arg DEBIAN_HACK_FLAVOR=$debianType \
-f "$pythonPlatformDir/prereqs/Dockerfile" \
-t "oryxdevmcr.azurecr.io/private/oryx/python-build-prereqs" $REPO_DIR
builtPythonHackPrereqs=true
builtPythonPrereqs=false
fi
elif ! $builtPythonPrereqs; then
echo "Building Python pre-requisites image..."
echo
docker build \
--build-arg DEBIAN_FLAVOR=$debianFlavor \
--build-arg DEBIAN_HACK_FLAVOR=$debianType \
-f "$pythonPlatformDir/prereqs/Dockerfile" \
-t "oryxdevmcr.azurecr.io/private/oryx/python-build-prereqs" $REPO_DIR
builtPythonPrereqs=true
builtPythonHackPrereqs=false
fi
}
buildPython() { buildPython() {
local version="$1" local version="$1"
@ -77,7 +42,6 @@ buildPython() {
fi fi
if shouldBuildSdk python $pythonSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk python; then if shouldBuildSdk python $pythonSdkFileName $sdkStorageAccountUrl || shouldOverwriteSdk || shouldOverwritePlatformSdk python; then
buildPythonPrereqsImage
echo "Building Python version '$version' in a docker image..." echo "Building Python version '$version' in a docker image..."
echo echo
@ -92,16 +56,14 @@ buildPython() {
cat $dockerFile cat $dockerFile
docker build \ rm -rf /usr/src/python
-f "$dockerFile" \ mkdir /usr/src/python
--build-arg VERSION_TO_BUILD=$version \ cd /usr/src/python
--build-arg GPG_KEYS=$gpgKey \ DEBIAN_FLAVOR=$debianFlavor PYTHON_VERSION=$version GPG_KEY=$gpgKey PIP_VERSION=$PIP_VERSION /tmp/build.sh
--build-arg PIP_VERSION=$PIP_VERSION \ cd $REPO_DIR
-t $imageName \
$REPO_DIR rm -r /opt/python/*
getSdkFromImage $imageName "$targetDir"
echo "$sdkVersionMetadataName=$version" >> $metadataFile echo "$sdkVersionMetadataName=$version" >> $metadataFile
echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile echo "$OS_TYPE_METADATA_NAME=$debianFlavor" >> $metadataFile
fi fi

Просмотреть файл

@ -176,7 +176,7 @@ if [ -n "$pipReqSetPath" ]; then
sed -i 's|logger\.debug('\''Cleaning up\.\.\.'\'')|logger\.info('\''Cleaning up\.\.\.'\'')|' "$pipReqSetPath" sed -i 's|logger\.debug('\''Cleaning up\.\.\.'\'')|logger\.info('\''Cleaning up\.\.\.'\'')|' "$pipReqSetPath"
fi fi
compressedSdkDir="/tmp/compressedSdk" compressedSdkDir="/tmp/compressedSdk/python"
mkdir -p $compressedSdkDir mkdir -p $compressedSdkDir
cd "$INSTALLATION_PREFIX" cd "$INSTALLATION_PREFIX"
tar -zcf $compressedSdkDir/$pythonSdkFileName . tar -zcf $compressedSdkDir/$pythonSdkFileName .

Просмотреть файл

@ -6,14 +6,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
{ {
public const string EnableDynamicInstallKey = "ENABLE_DYNAMIC_INSTALL"; public const string EnableDynamicInstallKey = "ENABLE_DYNAMIC_INSTALL";
public const string SdkStorageBaseUrlKeyName = "ORYX_SDK_STORAGE_BASE_URL"; public const string SdkStorageBaseUrlKeyName = "ORYX_SDK_STORAGE_BASE_URL";
public const string TestingSdkStorageUrlKeyName = "ORYX_TEST_SDK_STORAGE_URL";
public const string PrivateStagingStorageSasTokenKey = "ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN";
public const string OryxKeyvaultUri = "https://oryx.vault.azure.net"; public const string OryxKeyvaultUri = "https://oryx.vault.azure.net";
public const string StagingStorageSasTokenKeyvaultSecretName = "ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN";
public const string PrivateStagingSdkStorageBaseUrl = "https://oryxsdksstaging.blob.core.windows.net";
public const string DevSdkStorageBaseUrl = "https://oryxsdksdev.blob.core.windows.net";
public const string SandboxSdkStorageBaseUrl = "https://oryxsdkssandbox.blob.core.windows.net";
public const string PrivateSdkStorageBaseUrl = "https://oryxsdksprivate.blob.core.windows.net";
public const string ProdSdkStorageBaseUrl = "https://oryxsdksprod.blob.core.windows.net"; public const string ProdSdkStorageBaseUrl = "https://oryxsdksprod.blob.core.windows.net";
public const string ProdBackupSdkStorageBaseUrl = "https://oryxsdksprodbackup.blob.core.windows.net"; public const string ProdBackupSdkStorageBaseUrl = "https://oryxsdksprodbackup.blob.core.windows.net";
public const string ProdSdkCdnStorageBaseUrl = "https://oryx-cdn.microsoft.io"; public const string ProdSdkCdnStorageBaseUrl = "https://oryx-cdn.microsoft.io";
@ -21,7 +14,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
public const string DefaultVersionFilePrefix = "defaultVersion"; public const string DefaultVersionFilePrefix = "defaultVersion";
public const string DefaultVersionFileType = "txt"; public const string DefaultVersionFileType = "txt";
public const string VersionsToBuildFileName = "versionsToBuild.txt"; public const string VersionsToBuildFileName = "versionsToBuild.txt";
public const string ContainerMetadataUrlFormat = "{0}/{1}?restype=container&comp=list&include=metadata&marker={2}&{3}"; public const string ContainerMetadataUrlFormat = "{0}/{1}?restype=container&comp=list&include=metadata&marker={2}";
public const string SdkDownloadSentinelFileName = ".oryx-sdkdownload-sentinel"; public const string SdkDownloadSentinelFileName = ".oryx-sdkdownload-sentinel";
public const string SdkVersionMetadataName = "Sdk_version"; public const string SdkVersionMetadataName = "Sdk_version";
public const string LegacySdkVersionMetadataName = "Version"; public const string LegacySdkVersionMetadataName = "Version";

Просмотреть файл

@ -183,21 +183,6 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
/// </summary> /// </summary>
public ShellScriptBuilder AddDefaultTestEnvironmentVariables() public ShellScriptBuilder AddDefaultTestEnvironmentVariables()
{ {
var testStorageAccountUrl = Environment.GetEnvironmentVariable(SdkStorageConstants.TestingSdkStorageUrlKeyName);
if (string.IsNullOrEmpty(testStorageAccountUrl))
{
testStorageAccountUrl = SdkStorageConstants.PrivateStagingSdkStorageBaseUrl;
}
this.SetEnvironmentVariable(SdkStorageConstants.SdkStorageBaseUrlKeyName, testStorageAccountUrl);
if (testStorageAccountUrl == SdkStorageConstants.PrivateStagingSdkStorageBaseUrl)
{
string stagingStorageSasToken = Environment.GetEnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey) ??
KeyVaultHelper.GetKeyVaultSecretValue(SdkStorageConstants.OryxKeyvaultUri, SdkStorageConstants.StagingStorageSasTokenKeyvaultSecretName);
this.SetEnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey, stagingStorageSasToken);
}
return this; return this;
} }

Просмотреть файл

@ -57,8 +57,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator.DotNetCore
{ {
var httpClient = this.HttpClientFactory.CreateClient("general"); var httpClient = this.HttpClientFactory.CreateClient("general");
var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl(); var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl();
var oryxSdkStorageAccountAccessToken = this.commonOptions.OryxSdkStorageAccountAccessToken; var xdoc = ListBlobsHelper.GetAllBlobs(sdkStorageBaseUrl, DotNetCoreConstants.PlatformName, httpClient);
var xdoc = ListBlobsHelper.GetAllBlobs(sdkStorageBaseUrl, DotNetCoreConstants.PlatformName, httpClient, oryxSdkStorageAccountAccessToken);
// keys represent runtime version, values represent sdk version // keys represent runtime version, values represent sdk version
var supportedVersions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var supportedVersions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

Просмотреть файл

@ -12,11 +12,9 @@ namespace Microsoft.Oryx.BuildScriptGenerator
{ {
internal static class ListBlobsHelper internal static class ListBlobsHelper
{ {
public static XDocument GetAllBlobs(string sdkStorageBaseUrl, string platform, HttpClient httpClient, string oryxSdkStorageAccountAccessToken) public static XDocument GetAllBlobs(string sdkStorageBaseUrl, string platform, HttpClient httpClient)
{ {
var oryxSdkStorageAccountAccessArgs = oryxSdkStorageAccountAccessToken?.TrimStart(new char[] { '?' }) ?? string.Empty; var url = string.Format(SdkStorageConstants.ContainerMetadataUrlFormat, sdkStorageBaseUrl, platform, string.Empty);
var url = string.Format(SdkStorageConstants.ContainerMetadataUrlFormat, sdkStorageBaseUrl, platform, string.Empty, oryxSdkStorageAccountAccessArgs);
string blobList; string blobList;
try try
{ {
@ -44,7 +42,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator
// and consolidate blobs from all the pages. // and consolidate blobs from all the pages.
do do
{ {
url = string.Format(SdkStorageConstants.ContainerMetadataUrlFormat, sdkStorageBaseUrl, platform, marker, oryxSdkStorageAccountAccessArgs); url = string.Format(SdkStorageConstants.ContainerMetadataUrlFormat, sdkStorageBaseUrl, platform, marker);
var blobListFromNextMarker = httpClient.GetStringAsync(url).Result; var blobListFromNextMarker = httpClient.GetStringAsync(url).Result;
var xdocFromNextMarker = XDocument.Parse(blobListFromNextMarker); var xdocFromNextMarker = XDocument.Parse(blobListFromNextMarker);
marker = xdocFromNextMarker.Root.Element("NextMarker").Value; marker = xdocFromNextMarker.Root.Element("NextMarker").Value;

Просмотреть файл

@ -65,8 +65,6 @@ namespace Microsoft.Oryx.BuildScriptGenerator
public string OryxSdkStorageBaseUrl { get; set; } public string OryxSdkStorageBaseUrl { get; set; }
public string OryxSdkStorageAccountAccessToken { get; set; }
public bool EnableTelemetry { get; set; } public bool EnableTelemetry { get; set; }
public string PreBuildScriptPath { get; set; } public string PreBuildScriptPath { get; set; }

Просмотреть файл

@ -116,7 +116,6 @@ namespace Microsoft.Oryx.BuildScriptGenerator
string directoryToInstall = null) string directoryToInstall = null)
{ {
var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl(); var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl();
var sdkStorageAccountAccessToken = this.CommonOptions.OryxSdkStorageAccountAccessToken;
var versionDirInTemp = directoryToInstall; var versionDirInTemp = directoryToInstall;
if (string.IsNullOrEmpty(versionDirInTemp)) if (string.IsNullOrEmpty(versionDirInTemp))

Просмотреть файл

@ -50,8 +50,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator
this.logger.LogDebug("Getting list of available versions for platform {platformName}.", platformName); this.logger.LogDebug("Getting list of available versions for platform {platformName}.", platformName);
var httpClient = this.HttpClientFactory.CreateClient("general"); var httpClient = this.HttpClientFactory.CreateClient("general");
var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl(); var sdkStorageBaseUrl = this.GetPlatformBinariesStorageBaseUrl();
var oryxSdkStorageAccountAccessToken = this.commonOptions.OryxSdkStorageAccountAccessToken; var xdoc = ListBlobsHelper.GetAllBlobs(sdkStorageBaseUrl, platformName, httpClient);
var xdoc = ListBlobsHelper.GetAllBlobs(sdkStorageBaseUrl, platformName, httpClient, oryxSdkStorageAccountAccessToken);
var supportedVersions = new List<string>(); var supportedVersions = new List<string>();
var isStretch = string.Equals(this.commonOptions.DebianFlavor, OsTypes.DebianStretch, StringComparison.OrdinalIgnoreCase); var isStretch = string.Equals(this.commonOptions.DebianFlavor, OsTypes.DebianStretch, StringComparison.OrdinalIgnoreCase);
@ -101,7 +100,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator
try try
{ {
defaultVersionContent = httpClient defaultVersionContent = httpClient
.GetStringAsync($"{defaultVersionUrl}{this.commonOptions.OryxSdkStorageAccountAccessToken}") .GetStringAsync($"{defaultVersionUrl}")
.Result; .Result;
} }
catch (AggregateException ae) catch (AggregateException ae)

Просмотреть файл

@ -51,7 +51,6 @@ namespace Microsoft.Oryx.BuildScriptGeneratorCli.Options
options.PostBuildScriptPath = this.GetStringValue(SettingsKeys.PostBuildScriptPath); options.PostBuildScriptPath = this.GetStringValue(SettingsKeys.PostBuildScriptPath);
options.PostBuildCommand = this.GetStringValue(SettingsKeys.PostBuildCommand); options.PostBuildCommand = this.GetStringValue(SettingsKeys.PostBuildCommand);
options.OryxSdkStorageBaseUrl = this.GetStringValue(SettingsKeys.OryxSdkStorageBaseUrl); options.OryxSdkStorageBaseUrl = this.GetStringValue(SettingsKeys.OryxSdkStorageBaseUrl);
options.OryxSdkStorageAccountAccessToken = this.GetStringValue(SettingsKeys.OryxSdkStorageAccountAccessToken);
options.AppType = this.GetStringValue(SettingsKeys.AppType); options.AppType = this.GetStringValue(SettingsKeys.AppType);
options.BuildCommandsFileName = this.GetStringValue(SettingsKeys.BuildCommandsFileName); options.BuildCommandsFileName = this.GetStringValue(SettingsKeys.BuildCommandsFileName);
options.CompressDestinationDir = this.GetBooleanValue(SettingsKeys.CompressDestinationDir); options.CompressDestinationDir = this.GetBooleanValue(SettingsKeys.CompressDestinationDir);

Просмотреть файл

@ -64,7 +64,6 @@ namespace Microsoft.Oryx.BuildScriptGeneratorCli
public const string YarnTimeOutConfig = "YARN_TIMEOUT_CONFIG"; public const string YarnTimeOutConfig = "YARN_TIMEOUT_CONFIG";
public const string PythonVirtualEnvironmentName = "VIRTUALENV_NAME"; public const string PythonVirtualEnvironmentName = "VIRTUALENV_NAME";
public const string OryxSdkStorageBaseUrl = "ORYX_SDK_STORAGE_BASE_URL"; public const string OryxSdkStorageBaseUrl = "ORYX_SDK_STORAGE_BASE_URL";
public const string OryxSdkStorageAccountAccessToken = "ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN";
public const string AppType = "ORYX_APP_TYPE"; public const string AppType = "ORYX_APP_TYPE";
public const string BuildCommandsFileName = "BUILDCOMMANDS_FILE"; public const string BuildCommandsFileName = "BUILDCOMMANDS_FILE";
public const string DynamicInstallRootDir = "DYNAMIC_INSTALL_ROOT_DIR"; public const string DynamicInstallRootDir = "DYNAMIC_INSTALL_ROOT_DIR";

Просмотреть файл

@ -29,7 +29,7 @@ namespace Oryx.BuildImage.Tests
public void ExecutesCommand_AfterInstallingPlatformIfNotPresentAlready() public void ExecutesCommand_AfterInstallingPlatformIfNotPresentAlready()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "17.6.0";
var volume = CreateWebFrontEndVolume(); var volume = CreateWebFrontEndVolume();
var appDir = volume.ContainerDir; var appDir = volume.ContainerDir;
var subDir = Guid.NewGuid(); var subDir = Guid.NewGuid();
@ -67,7 +67,7 @@ namespace Oryx.BuildImage.Tests
public void ExecutesCommand_AfterInstallingPlatformVersionSpecifiedByBuildEnvFile() public void ExecutesCommand_AfterInstallingPlatformVersionSpecifiedByBuildEnvFile()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "17.6.0";
var volume = CreateWebFrontEndVolume(); var volume = CreateWebFrontEndVolume();
var appDir = volume.ContainerDir; var appDir = volume.ContainerDir;
var subDir = Guid.NewGuid(); var subDir = Guid.NewGuid();

Просмотреть файл

@ -54,10 +54,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
Assert.NotNull(dotNetCorePlatform); Assert.NotNull(dotNetCorePlatform);
Assert.NotNull(dotNetCorePlatform.Versions); Assert.NotNull(dotNetCorePlatform.Versions);
Assert.True(dotNetCorePlatform.Versions.Any()); Assert.True(dotNetCorePlatform.Versions.Any());
Assert.True(dotNetCorePlatform.Versions.Contains("1.1.13")); Assert.True(dotNetCorePlatform.Versions.Contains("2.1.23"));
Assert.True(dotNetCorePlatform.Versions.Contains("5.0.0-preview.3.20214.6")); Assert.True(dotNetCorePlatform.Versions.Contains("5.0.17"));
Assert.True(dotNetCorePlatform.Versions.Contains("6.0.0-rc.1.21451.13")); Assert.True(dotNetCorePlatform.Versions.Contains("6.0.0-preview.7.21377.19"));
Assert.True(dotNetCorePlatform.Versions.Contains("7.0.0-preview.1.22076.8")); Assert.True(dotNetCorePlatform.Versions.Contains("7.0.3"));
var nodePlatform = actualResults var nodePlatform = actualResults
.Where(pr => pr.Name.EqualsIgnoreCase(NodeConstants.PlatformName)) .Where(pr => pr.Name.EqualsIgnoreCase(NodeConstants.PlatformName))
@ -65,7 +65,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
Assert.NotNull(nodePlatform); Assert.NotNull(nodePlatform);
Assert.NotNull(nodePlatform.Versions); Assert.NotNull(nodePlatform.Versions);
Assert.True(nodePlatform.Versions.Any()); Assert.True(nodePlatform.Versions.Any());
Assert.True(nodePlatform.Versions.Contains("4.4.7")); Assert.True(nodePlatform.Versions.Contains("17.6.0"));
var pythonPlatform = actualResults var pythonPlatform = actualResults
.Where(pr => pr.Name.EqualsIgnoreCase(PythonConstants.PlatformName)) .Where(pr => pr.Name.EqualsIgnoreCase(PythonConstants.PlatformName))
@ -73,9 +73,9 @@ namespace Microsoft.Oryx.BuildImage.Tests
Assert.NotNull(pythonPlatform); Assert.NotNull(pythonPlatform);
Assert.NotNull(pythonPlatform.Versions); Assert.NotNull(pythonPlatform.Versions);
Assert.True(pythonPlatform.Versions.Any()); Assert.True(pythonPlatform.Versions.Any());
Assert.True(pythonPlatform.Versions.Contains("2.7.17")); Assert.True(pythonPlatform.Versions.Contains("3.6.12"));
Assert.True(pythonPlatform.Versions.Contains("3.8.4rc1")); Assert.True(pythonPlatform.Versions.Contains("3.7.9"));
Assert.True(pythonPlatform.Versions.Contains("3.9.0b1")); Assert.True(pythonPlatform.Versions.Contains("3.9.15"));
Assert.True(pythonPlatform.Versions.Contains("3.9.0")); Assert.True(pythonPlatform.Versions.Contains("3.9.0"));
Assert.True(pythonPlatform.Versions.Contains("3.10.4")); Assert.True(pythonPlatform.Versions.Contains("3.10.4"));
@ -85,7 +85,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
Assert.NotNull(phpPlatform); Assert.NotNull(phpPlatform);
Assert.NotNull(phpPlatform.Versions); Assert.NotNull(phpPlatform.Versions);
Assert.True(phpPlatform.Versions.Any()); Assert.True(phpPlatform.Versions.Any());
Assert.True(phpPlatform.Versions.Contains("8.1.6")); Assert.True(phpPlatform.Versions.Contains("7.4.14"));
var hugoPlatform = actualResults var hugoPlatform = actualResults
.Where(pr => pr.Name.EqualsIgnoreCase(HugoConstants.PlatformName)) .Where(pr => pr.Name.EqualsIgnoreCase(HugoConstants.PlatformName))
@ -94,16 +94,6 @@ namespace Microsoft.Oryx.BuildImage.Tests
Assert.NotNull(hugoPlatform.Versions); Assert.NotNull(hugoPlatform.Versions);
Assert.True(hugoPlatform.Versions.Any()); Assert.True(hugoPlatform.Versions.Any());
Assert.True(hugoPlatform.Versions.Contains(HugoConstants.Version)); Assert.True(hugoPlatform.Versions.Contains(HugoConstants.Version));
var rubyPlatform = actualResults
.Where(pr => pr.Name.EqualsIgnoreCase(RubyConstants.PlatformName))
.FirstOrDefault();
Assert.NotNull(rubyPlatform);
Assert.NotNull(rubyPlatform.Versions);
Assert.True(rubyPlatform.Versions.Any());
Assert.True(rubyPlatform.Versions.Contains("2.6.6"));
Assert.True(rubyPlatform.Versions.Contains("2.7.1"));
Assert.True(rubyPlatform.Versions.Contains("3.0.3"));
}, },
result.GetDebugInfo()); result.GetDebugInfo());
} }

Просмотреть файл

@ -1,4 +1,4 @@
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved. // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. // Licensed under the MIT license.
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -62,7 +62,7 @@ namespace Oryx.BuildImage.Tests
public void DetectsAndInstallsPlatformVersion_SpecifiedByEnvironmentVariable() public void DetectsAndInstallsPlatformVersion_SpecifiedByEnvironmentVariable()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "12.19.0";
var volume = CreateWebFrontEndVolume(); var volume = CreateWebFrontEndVolume();
var appDir = volume.ContainerDir; var appDir = volume.ContainerDir;
var subDir = Guid.NewGuid(); var subDir = Guid.NewGuid();
@ -97,7 +97,7 @@ namespace Oryx.BuildImage.Tests
public void DetectsAndInstallsPlatformVersion_SpecifiedByBuildEnvFile() public void DetectsAndInstallsPlatformVersion_SpecifiedByBuildEnvFile()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "12.19.0";
var volume = CreateWebFrontEndVolume(); var volume = CreateWebFrontEndVolume();
var appDir = volume.ContainerDir; var appDir = volume.ContainerDir;
var script = new ShellScriptBuilder() var script = new ShellScriptBuilder()
@ -132,8 +132,8 @@ namespace Oryx.BuildImage.Tests
public void SkipsDetectionAndInstallsPlatform() public void SkipsDetectionAndInstallsPlatform()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "12.19.0";
var pythonVersion = "3.7.7"; var pythonVersion = "3.10.0";
var script = new ShellScriptBuilder() var script = new ShellScriptBuilder()
.AddCommand( .AddCommand(
$"oryx prep --skip-detection --platforms-and-versions " + $"oryx prep --skip-detection --platforms-and-versions " +
@ -165,8 +165,8 @@ namespace Oryx.BuildImage.Tests
public void SkipsDetectionAndInstallsPlatformsFromFile() public void SkipsDetectionAndInstallsPlatformsFromFile()
{ {
// Arrange // Arrange
var nodeVersion = "8.0.0"; var nodeVersion = "16.5.0";
var pythonVersion = "3.7.7"; var pythonVersion = "3.10.0";
var versionsFile = "/tmp/versions.txt"; var versionsFile = "/tmp/versions.txt";
var script = new ShellScriptBuilder() var script = new ShellScriptBuilder()
.AddCommand($"echo 'nodejs={nodeVersion}' >> {versionsFile}") .AddCommand($"echo 'nodejs={nodeVersion}' >> {versionsFile}")
@ -201,7 +201,7 @@ namespace Oryx.BuildImage.Tests
public void InstallsPlatformAtCustomInstallationRootDirectory() public void InstallsPlatformAtCustomInstallationRootDirectory()
{ {
// Arrange // Arrange
var nodeVersion = "4.4.7"; var nodeVersion = "16.5.0";
var customDynamicInstallRootDir = "/foo/bar"; var customDynamicInstallRootDir = "/foo/bar";
var expectedText = var expectedText =
$"Node path is: {customDynamicInstallRootDir}/{NodeConstants.PlatformName}/{nodeVersion}/bin"; $"Node path is: {customDynamicInstallRootDir}/{NodeConstants.PlatformName}/{nodeVersion}/bin";

Просмотреть файл

@ -54,7 +54,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
string runtimeVersion) string runtimeVersion)
{ {
BuildsApplication_ByDynamicallyInstallingSDKs( BuildsApplication_ByDynamicallyInstallingSDKs(
appName, runtimeVersion, _restrictedPermissionsImageHelper.GetGitHubActionsBuildImage()); appName, runtimeVersion, _imageHelper.GetGitHubActionsBuildImage());
} }
[Theory, Trait("category", "cli-stretch")] [Theory, Trait("category", "cli-stretch")]
@ -164,7 +164,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
""rollForward"": ""Disable"" ""rollForward"": ""Disable""
} }
}"; }";
var globalJsonSdkVersion = "3.1.201"; var globalJsonSdkVersion = "3.1.404";
var globalJsonContent = globalJsonTemplate.Replace("#version#", globalJsonSdkVersion); var globalJsonContent = globalJsonTemplate.Replace("#version#", globalJsonSdkVersion);
var sentinelFile = $"{Constants.TemporaryInstallationDirectoryRoot}/{DotNetCoreConstants.PlatformName}/{globalJsonSdkVersion}/" + var sentinelFile = $"{Constants.TemporaryInstallationDirectoryRoot}/{DotNetCoreConstants.PlatformName}/{globalJsonSdkVersion}/" +
$"{SdkStorageConstants.SdkDownloadSentinelFileName}"; $"{SdkStorageConstants.SdkDownloadSentinelFileName}";
@ -212,7 +212,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
// Here we are testing building a 2.1 runtime version app with a 3.1 sdk version // Here we are testing building a 2.1 runtime version app with a 3.1 sdk version
// Arrange // Arrange
var expectedSdkVersion = "3.1.201"; var expectedSdkVersion = "3.1.404";
var globalJsonTemplate = @" var globalJsonTemplate = @"
{ {
""sdk"": { ""sdk"": {
@ -275,7 +275,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
// Here we are testing building a 2.1 runtime version app with a 3.1 sdk version // Here we are testing building a 2.1 runtime version app with a 3.1 sdk version
// Arrange // Arrange
var expectedSdkVersion = "3.1.201"; var expectedSdkVersion = "3.1.404";
var globalJsonTemplate = @" var globalJsonTemplate = @"
{ {
""sdk"": { ""sdk"": {
@ -433,7 +433,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
// Here we are testing building a 2.1 runtime version app with a 3.1 sdk version // Here we are testing building a 2.1 runtime version app with a 3.1 sdk version
// Arrange // Arrange
var expectedSdkVersion = "3.1.201"; var expectedSdkVersion = "3.1.404";
var globalJsonTemplate = @" var globalJsonTemplate = @"
{ {
""sdk"": { ""sdk"": {

Просмотреть файл

@ -28,7 +28,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
{ {
var data = new TheoryData<string, string>(); var data = new TheoryData<string, string>();
var imageTestHelper = new ImageTestHelper(); var imageTestHelper = new ImageTestHelper();
data.Add("12.22.12", imageTestHelper.GetGitHubActionsBuildImage()); data.Add("17.1.0", imageTestHelper.GetGitHubActionsBuildImage());
data.Add(FinalStretchVersions.FinalStretchNode14Version, imageTestHelper.GetGitHubActionsBuildImage()); data.Add(FinalStretchVersions.FinalStretchNode14Version, imageTestHelper.GetGitHubActionsBuildImage());
data.Add(FinalStretchVersions.FinalStretchNode16Version, imageTestHelper.GetGitHubActionsBuildImage()); data.Add(FinalStretchVersions.FinalStretchNode16Version, imageTestHelper.GetGitHubActionsBuildImage());
return data; return data;
@ -163,7 +163,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
[Theory, Trait("category", "githubactions")] [Theory, Trait("category", "githubactions")]
[Trait("build-image", "github-actions-debian-stretch")] [Trait("build-image", "github-actions-debian-stretch")]
[InlineData("14.19.1", "14.19.1")] [InlineData("14.19.1", "14.19.1")]
[InlineData("16", FinalStretchVersions.FinalStretchNode16Version)] [InlineData("16", "16.20.2")]
public void GeneratesScript_AndBuildNodeAppsWithDynamicInstallation_DefaultEnvVar(string defaultVersion, string expectedVersion) public void GeneratesScript_AndBuildNodeAppsWithDynamicInstallation_DefaultEnvVar(string defaultVersion, string expectedVersion)
{ {
// Arrange // Arrange
@ -238,7 +238,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
public void DynamicInstall_ReInstallsSdk_IfSentinelFileIsNotPresent() public void DynamicInstall_ReInstallsSdk_IfSentinelFileIsNotPresent()
{ {
// Arrange // Arrange
var version = "12.16.1"; //NOTE: use the full version so that we know the install directory path var version = "12.22.4"; //NOTE: use the full version so that we know the install directory path
var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/nodejs/{version}"; var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/nodejs/{version}";
var sentinelFile = $"{installationDir}/{SdkStorageConstants.SdkDownloadSentinelFileName}"; var sentinelFile = $"{installationDir}/{SdkStorageConstants.SdkDownloadSentinelFileName}";
var volume = CreateWebFrontEndVolume(); var volume = CreateWebFrontEndVolume();
@ -316,11 +316,11 @@ namespace Microsoft.Oryx.BuildImage.Tests
} }
[Fact, Trait("category", "githubactions")] [Fact, Trait("category", "githubactions")]
[Trait("build-image", "github-actions-debian-stretch")] [Trait("build-image", "github-actions-debian-buster")]
public void BuildNodeApp_AfterInstallingStretchSpecificSdk() public void BuildNodeApp_AfterInstallingBusterSpecificSdk()
{ {
// Arrange // Arrange
var version = "9.4.0"; // version only exists for stretch images var version = "16.20.2";
var devPackageName = "nodemon"; var devPackageName = "nodemon";
var prodPackageName = "express"; var prodPackageName = "express";

Просмотреть файл

@ -38,7 +38,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion);
data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion);
// Test PHP composer version 2.2.x // // Test PHP composer version 2.2.x
data.Add( data.Add(
PhpVersions.Php73Version, PhpVersions.Php73Version,
ImageTestHelper.WithRestrictedPermissions().GetGitHubActionsBuildImage(), ImageTestHelper.WithRestrictedPermissions().GetGitHubActionsBuildImage(),
@ -50,7 +50,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version);
data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version);
// Test PHP composer version 2.3.x // // Test PHP composer version 2.3.x
data.Add( data.Add(
PhpVersions.Php73Version, PhpVersions.Php73Version,
ImageTestHelper.WithRestrictedPermissions().GetGitHubActionsBuildImage(), ImageTestHelper.WithRestrictedPermissions().GetGitHubActionsBuildImage(),
@ -342,7 +342,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
public void BuildsApplication_ByDynamicallyInstalling_IntoCustomDynamicInstallationDir() public void BuildsApplication_ByDynamicallyInstalling_IntoCustomDynamicInstallationDir()
{ {
// Arrange // Arrange
var phpVersion = "7.3.15"; //NOTE: use the full version so that we know the install directory path var phpVersion = "7.3.21"; //NOTE: use the full version so that we know the install directory path
var appName = "twig-example"; var appName = "twig-example";
var volume = CreateSampleAppVolume(appName); var volume = CreateSampleAppVolume(appName);
var appDir = volume.ContainerDir; var appDir = volume.ContainerDir;
@ -376,83 +376,83 @@ namespace Microsoft.Oryx.BuildImage.Tests
result.GetDebugInfo()); result.GetDebugInfo());
} }
[Fact, Trait("category", "githubactions")] // [Fact, Trait("category", "githubactions")]
public void BuildPhpApp_AfterInstallingStretchSpecificSdk() // public void BuildPhpApp_AfterInstallingStretchSpecificSdk()
{ // {
// Arrange // // Arrange
var version = "7.0.33"; // version only exists on stretch // var version = "7.0.33"; // version only exists on stretch
var composerVersion = "1.10.0"; // var composerVersion = "1.10.0";
var appName = "twig-example"; // var appName = "twig-example";
var volume = CreateSampleAppVolume(appName); // var volume = CreateSampleAppVolume(appName);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var appOutputDir = "/tmp/app-output"; // var appOutputDir = "/tmp/app-output";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.SetEnvironmentVariable("PHP_COMPOSER_VERSION", composerVersion) // .SetEnvironmentVariable("PHP_COMPOSER_VERSION", composerVersion)
.AddBuildCommand( // .AddBuildCommand(
$"{appDir} -o {appOutputDir} --platform {PhpConstants.PlatformName} --platform-version {version}") // $"{appDir} -o {appOutputDir} --platform {PhpConstants.PlatformName} --platform-version {version}")
.ToString(); // .ToString();
// Act // // Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetGitHubActionsBuildImage(), // ImageId = _imageHelper.GetGitHubActionsBuildImage(),
EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) }, // EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) },
Volumes = new List<DockerVolume> { volume }, // Volumes = new List<DockerVolume> { volume },
CommandToExecuteOnRun = "/bin/bash", // CommandToExecuteOnRun = "/bin/bash",
CommandArguments = new[] { "-c", script } // CommandArguments = new[] { "-c", script }
}); // });
// Assert // // Assert
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains( // Assert.Contains(
$"PHP executable: " + // $"PHP executable: " +
BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot, result.StdOut); // BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot, result.StdOut);
Assert.Contains("Installing twig/twig", result.StdErr); // Composer prints its messages to STDERR // Assert.Contains("Installing twig/twig", result.StdErr); // Composer prints its messages to STDERR
Assert.Contains($"\'php-composer\' version \'{composerVersion}\'", result.StdOut); // Assert.Contains($"\'php-composer\' version \'{composerVersion}\'", result.StdOut);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory, Trait("category", "githubactions")] // [Theory, Trait("category", "githubactions")]
[InlineData(ImageTestHelperConstants.GitHubActionsBuster)] // [InlineData(ImageTestHelperConstants.GitHubActionsBuster)]
[InlineData(ImageTestHelperConstants.GitHubActionsBullseye)] // [InlineData(ImageTestHelperConstants.GitHubActionsBullseye)]
public void PhpFails_ToInstallStretchSdk_OnNonStretchImage(string imageTag) // public void PhpFails_ToInstallStretchSdk_OnNonStretchImage(string imageTag)
{ // {
// Arrange // // Arrange
var version = "7.0.33"; // version only exists on stretch // var version = "7.0.33"; // version only exists on stretch
var composerVersion = "1.10.0"; // var composerVersion = "1.10.0";
var appName = "twig-example"; // var appName = "twig-example";
var volume = CreateSampleAppVolume(appName); // var volume = CreateSampleAppVolume(appName);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var appOutputDir = "/tmp/app-output"; // var appOutputDir = "/tmp/app-output";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.SetEnvironmentVariable("PHP_COMPOSER_VERSION", composerVersion) // .SetEnvironmentVariable("PHP_COMPOSER_VERSION", composerVersion)
.AddBuildCommand( // .AddBuildCommand(
$"{appDir} -o {appOutputDir} --platform {PhpConstants.PlatformName} --platform-version {version}") // $"{appDir} -o {appOutputDir} --platform {PhpConstants.PlatformName} --platform-version {version}")
.ToString(); // .ToString();
// Act // // Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetGitHubActionsBuildImage(imageTag), // ImageId = _imageHelper.GetGitHubActionsBuildImage(imageTag),
EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) }, // EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) },
Volumes = new List<DockerVolume> { volume }, // Volumes = new List<DockerVolume> { volume },
CommandToExecuteOnRun = "/bin/bash", // CommandToExecuteOnRun = "/bin/bash",
CommandArguments = new[] { "-c", script } // CommandArguments = new[] { "-c", script }
}); // });
// Assert // // Assert
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.False(result.IsSuccess); // Assert.False(result.IsSuccess);
Assert.Contains($"Error: Platform '{PhpConstants.PlatformName}' version '{version}' is unsupported.", result.StdErr); // Assert.Contains($"Error: Platform '{PhpConstants.PlatformName}' version '{version}' is unsupported.", result.StdErr);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
private DockerVolume CreateSampleAppVolume(string sampleAppName) => private DockerVolume CreateSampleAppVolume(string sampleAppName) =>
DockerVolume.CreateMirror(Path.Combine(_hostSamplesDir, "php", sampleAppName)); DockerVolume.CreateMirror(Path.Combine(_hostSamplesDir, "php", sampleAppName));

Просмотреть файл

@ -81,9 +81,9 @@ namespace Microsoft.Oryx.BuildImage.Tests
[Fact] [Fact]
[Trait("category", "jamstack")] [Trait("category", "jamstack")]
public void PulledJamstackStretchBuildImages_Contains_BUILDIMAGE_TYPE_Info() public void PulledJamstackBullseyeBuildImages_Contains_BUILDIMAGE_TYPE_Info()
{ {
PulledBuildImages_Contains_BUILDIMAGE_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.AzureFunctionsJamStackStretch), "jamstack"); PulledBuildImages_Contains_BUILDIMAGE_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.AzureFunctionsJamStackBullseye), "jamstack");
} }
[Fact] [Fact]

Просмотреть файл

@ -57,12 +57,12 @@ namespace Microsoft.Oryx.BuildImage.Tests
PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.LtsVersionsBuster), "DEBIAN|BUSTER"); PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.LtsVersionsBuster), "DEBIAN|BUSTER");
} }
[Fact] // [Fact]
[Trait("category", "githubactions")] // [Trait("category", "githubactions")]
public void PulledGitHubActionsStretchBuildImages_Contains_BUILDOS_TYPE_Info() // public void PulledGitHubActionsStretchBuildImages_Contains_BUILDOS_TYPE_Info()
{ // {
PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.GitHubActionsStretch), "DEBIAN|STRETCH"); // PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.GitHubActionsStretch), "DEBIAN|STRETCH");
} // }
[Fact] [Fact]
[Trait("category", "githubactions")] [Trait("category", "githubactions")]
@ -99,14 +99,6 @@ namespace Microsoft.Oryx.BuildImage.Tests
PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), "DEBIAN|BULLSEYE"); PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), "DEBIAN|BULLSEYE");
} }
[Fact]
[Trait("category", "jamstack")]
public void PulledJamstackStretchBuildImages_Contains_BUILDOS_TYPE_Info()
{
PulledBuildImages_Contains_BUILDOS_TYPE_Info(_imageHelper.GetBuildImage(ImageTestHelperConstants.AzureFunctionsJamStackStretch), "DEBIAN|STRETCH");
}
[Fact] [Fact]
[Trait("category", "jamstack")] [Trait("category", "jamstack")]
public void PulledJamstackBusterBuildImages_Contains_BUILDOS_TYPE_Info() public void PulledJamstackBusterBuildImages_Contains_BUILDOS_TYPE_Info()

Просмотреть файл

@ -253,8 +253,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
} }
[Theory, Trait("category", "githubactions")] [Theory, Trait("category", "githubactions")]
[InlineData("3.8.0b3")] [InlineData("3.10.0a2")]
[InlineData("3.9.0b1")]
public void GeneratesScript_AndBuildsPythonPreviewVersion(string previewVersion) public void GeneratesScript_AndBuildsPythonPreviewVersion(string previewVersion)
{ {
// Arrange // Arrange
@ -273,7 +272,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
// Act // Act
var result = _dockerCli.Run(new DockerRunArguments var result = _dockerCli.Run(new DockerRunArguments
{ {
ImageId = _restrictedPermissionsImageHelper.GetGitHubActionsBuildImage(), ImageId = _imageHelper.GetGitHubActionsBuildImage(),
EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) }, EnvironmentVariables = new List<EnvironmentVariable> { CreateAppNameEnvVar(appName) },
Volumes = new List<DockerVolume> { volume }, Volumes = new List<DockerVolume> { volume },
CommandToExecuteOnRun = "/bin/bash", CommandToExecuteOnRun = "/bin/bash",
@ -296,7 +295,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
public void DynamicInstall_ReInstallsSdk_IfSentinelFileIsNotPresent() public void DynamicInstall_ReInstallsSdk_IfSentinelFileIsNotPresent()
{ {
// Arrange // Arrange
var version = "3.8.1"; //NOTE: use the full version so that we know the install directory path var version = "3.8.16"; //NOTE: use the full version so that we know the install directory path
var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/" + var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/" +
$"python/{version}"; $"python/{version}";
var sentinelFile = $"{installationDir}/{SdkStorageConstants.SdkDownloadSentinelFileName}"; var sentinelFile = $"{installationDir}/{SdkStorageConstants.SdkDownloadSentinelFileName}";
@ -338,7 +337,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
public void BuildsAzureFunctionApp() public void BuildsAzureFunctionApp()
{ {
// Arrange // Arrange
var version = "3.8.1"; var version = "3.8.18";
var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/" + var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}/" +
$"python/{version}"; $"python/{version}";
var appName = "Python_HttpTriggerSample"; var appName = "Python_HttpTriggerSample";
@ -418,7 +417,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
public void GeneratesScript_AndBuilds_WithPackageDir() public void GeneratesScript_AndBuilds_WithPackageDir()
{ {
// Arrange // Arrange
var version = "3.6.9"; var version = "3.10.13";
var appName = "flask-app"; var appName = "flask-app";
var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}" + var installationDir = $"{BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot}" +
$"/python/{version}"; $"/python/{version}";
@ -463,7 +462,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
var imageHelper = new ImageTestHelper(); var imageHelper = new ImageTestHelper();
// stretch // stretch
data.Add(PythonVersions.Python27Version, imageHelper.GetAzureFunctionsJamStackBuildImage()); // data.Add(PythonVersions.Python27Version, imageHelper.GetAzureFunctionsJamStackBuildImage());
//buster //buster
data.Add(PythonVersions.Python36Version, imageHelper.GetAzureFunctionsJamStackBuildImage(ImageTestHelperConstants.AzureFunctionsJamStackBuster)); data.Add(PythonVersions.Python36Version, imageHelper.GetAzureFunctionsJamStackBuildImage(ImageTestHelperConstants.AzureFunctionsJamStackBuster));

Просмотреть файл

@ -97,7 +97,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act

Просмотреть файл

@ -1,24 +0,0 @@
// --------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// --------------------------------------------------------------------------------------------
using Microsoft.Oryx.BuildScriptGenerator.Common;
using Microsoft.Oryx.Tests.Common;
using Xunit;
using Xunit.Abstractions;
namespace Oryx.Integration.Tests
{
[Trait("StorageAccountTests", "Prod")]
public class ProdStorageAccountSanityTest : StorageAccountSanityTestBase
{
public ProdStorageAccountSanityTest(
ITestOutputHelper output,
TestTempDirTestFixture testTempDirTestFixture,
RepoRootDirTestFixture repoRootDirTestFixture)
: base(SdkStorageConstants.ProdSdkStorageBaseUrl, output, testTempDirTestFixture, repoRootDirTestFixture)
{
}
}
}

Просмотреть файл

@ -11,18 +11,18 @@ using Xunit.Abstractions;
namespace Oryx.Integration.Tests namespace Oryx.Integration.Tests
{ {
[Trait("StorageAccountTests", "Staging")] [Trait("StorageAccountTests", "SanityTests")]
public class StagingStorageAccountSanityTest : StorageAccountSanityTestBase public class StorageAccountSanityTest : StorageAccountSanityTestBase
{ {
public StagingStorageAccountSanityTest( public StorageAccountSanityTest(
ITestOutputHelper output, ITestOutputHelper output,
TestTempDirTestFixture testTempDirTestFixture, TestTempDirTestFixture testTempDirTestFixture,
RepoRootDirTestFixture repoRootDirTestFixture) RepoRootDirTestFixture repoRootDirTestFixture)
: base( : base(Environment.GetEnvironmentVariable(SdkStorageConstants.SdkStorageBaseUrlKeyName)
Environment.GetEnvironmentVariable(SdkStorageConstants.TestingSdkStorageUrlKeyName) ?? SdkStorageConstants.PrivateStagingSdkStorageBaseUrl, ?? throw new InvalidOperationException($"Environment variable '{SdkStorageConstants.SdkStorageBaseUrlKeyName}' is required."),
output, output,
testTempDirTestFixture, testTempDirTestFixture,
repoRootDirTestFixture) repoRootDirTestFixture)
{ {
} }
} }

Просмотреть файл

@ -29,7 +29,6 @@ namespace Oryx.Integration.Tests
private readonly string _storageUrl; private readonly string _storageUrl;
private readonly string _repoRootDir; private readonly string _repoRootDir;
private readonly string _stagingStorageAccountAccessToken;
private readonly string[] _debianFlavors = private readonly string[] _debianFlavors =
{ {
@ -45,14 +44,6 @@ namespace Oryx.Integration.Tests
{ {
_storageUrl = storageUrl; _storageUrl = storageUrl;
_repoRootDir = repoRootDirTestFixture.RepoRootDirPath; _repoRootDir = repoRootDirTestFixture.RepoRootDirPath;
_stagingStorageAccountAccessToken = string.Empty;
if (storageUrl == SdkStorageConstants.PrivateStagingSdkStorageBaseUrl)
{
_stagingStorageAccountAccessToken = Environment.GetEnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey) != null
? Environment.GetEnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey)
: KeyVaultHelper.GetKeyVaultSecretValue(SdkStorageConstants.OryxKeyvaultUri, SdkStorageConstants.StagingStorageSasTokenKeyvaultSecretName);
}
} }
[Fact] [Fact]
@ -186,7 +177,7 @@ namespace Oryx.Integration.Tests
{ {
// Act // Act
var error = Assert.Throws<AggregateException>(() => var error = Assert.Throws<AggregateException>(() =>
ListBlobsHelper.GetAllBlobs(_fakeStorageUrl, "dotnet", _httpClient, _stagingStorageAccountAccessToken)); ListBlobsHelper.GetAllBlobs(_fakeStorageUrl, "dotnet", _httpClient));
// Assert // Assert
Assert.Contains(Microsoft.Oryx.BuildScriptGenerator.Constants.NetworkConfigurationHelpText, error.Message); Assert.Contains(Microsoft.Oryx.BuildScriptGenerator.Constants.NetworkConfigurationHelpText, error.Message);
@ -223,7 +214,7 @@ namespace Oryx.Integration.Tests
private XDocument GetMetadata(string platformName) private XDocument GetMetadata(string platformName)
{ {
return ListBlobsHelper.GetAllBlobs(_storageUrl, platformName, _httpClient, _stagingStorageAccountAccessToken); return ListBlobsHelper.GetAllBlobs(_storageUrl, platformName, _httpClient);
} }
private List<string> GetVersionsFromContainer(string debianFlavor, string platformName) private List<string> GetVersionsFromContainer(string debianFlavor, string platformName)
@ -266,7 +257,7 @@ namespace Oryx.Integration.Tests
|| string.Equals(debianFlavor, OsTypes.DebianStretch, StringComparison.OrdinalIgnoreCase) || string.Equals(debianFlavor, OsTypes.DebianStretch, StringComparison.OrdinalIgnoreCase)
? SdkStorageConstants.DefaultVersionFileName ? SdkStorageConstants.DefaultVersionFileName
: $"{SdkStorageConstants.DefaultVersionFilePrefix}.{debianFlavor}.{SdkStorageConstants.DefaultVersionFileType}"; : $"{SdkStorageConstants.DefaultVersionFilePrefix}.{debianFlavor}.{SdkStorageConstants.DefaultVersionFileType}";
var defaultVersionUrl = $"{_storageUrl}/{platformName}/{defaultFile}{_stagingStorageAccountAccessToken}"; var defaultVersionUrl = $"{_storageUrl}/{platformName}/{defaultFile}";
var defaultVersionContent = _httpClient.GetStringAsync(defaultVersionUrl).Result; var defaultVersionContent = _httpClient.GetStringAsync(defaultVersionUrl).Result;
string defaultVersion = null; string defaultVersion = null;

Просмотреть файл

@ -18,9 +18,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.1")] [InlineData("6.0")]
[InlineData("5.0")]
[InlineData("7.0")]
public void GDIPlusLibrary_IsPresentInTheBusterImage(string version) public void GDIPlusLibrary_IsPresentInTheBusterImage(string version)
{ {
// Arrange // Arrange
@ -47,8 +45,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.1")] [InlineData("8.0")]
[InlineData("7.0")]
public void GDIPlusLibrary_IsPresentInTheBullseyeImage(string version) public void GDIPlusLibrary_IsPresentInTheBullseyeImage(string version)
{ {
// Arrange // Arrange
@ -75,10 +72,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.1")]
[InlineData("5.0")]
[InlineData("6.0")] [InlineData("6.0")]
[InlineData("7.0")]
public void DotnetMonitorTool_IsPresentInTheBusterImage(string version) public void DotnetMonitorTool_IsPresentInTheBusterImage(string version)
{ {
// Act // Act
@ -102,9 +96,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.1")]
[InlineData("6.0")] [InlineData("6.0")]
[InlineData("7.0")]
public void DotnetMonitorTool_IsPresentInTheBullseyeImage(string version) public void DotnetMonitorTool_IsPresentInTheBullseyeImage(string version)
{ {
// Act // Act

Просмотреть файл

@ -21,7 +21,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.1")] [InlineData("6.0")]
public void DotNetCoreBullseyeRuntimeImage_Contains_VersionAndCommit_Information(string version) public void DotNetCoreBullseyeRuntimeImage_Contains_VersionAndCommit_Information(string version)
{ {
// we cant always rely on gitcommitid as env variable in case build context is not correctly passed // we cant always rely on gitcommitid as env variable in case build context is not correctly passed
@ -31,7 +31,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
Skip.If(string.IsNullOrEmpty(agentOS)); Skip.If(string.IsNullOrEmpty(agentOS));
// Arrange // Arrange
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
@ -59,10 +59,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.0")]
[InlineData("5.0")]
[InlineData("6.0")] [InlineData("6.0")]
[InlineData("7.0")]
public void DotNetCoreBusterRuntimeImage_Contains_VersionAndCommit_Information(string version) public void DotNetCoreBusterRuntimeImage_Contains_VersionAndCommit_Information(string version)
{ {
// we cant always rely on gitcommitid as env variable in case build context is not correctly passed // we cant always rely on gitcommitid as env variable in case build context is not correctly passed
@ -72,7 +69,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
Skip.If(string.IsNullOrEmpty(agentOS)); Skip.If(string.IsNullOrEmpty(agentOS));
// Arrange // Arrange
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
@ -100,11 +97,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp30)]
[InlineData("3.1", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp31)]
[InlineData("5.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp50)]
[InlineData("6.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp60)] [InlineData("6.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp60)]
[InlineData("7.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp70)]
[Trait(TestConstants.Category, TestConstants.Release)] [Trait(TestConstants.Category, TestConstants.Release)]
public void RuntimeImage_Buster_HasExecptedDotNetVersion(string version, string expectedOutput) public void RuntimeImage_Buster_HasExecptedDotNetVersion(string version, string expectedOutput)
{ {
@ -129,9 +122,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.1", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp31)]
[InlineData("6.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp60)] [InlineData("6.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp60)]
[InlineData("7.0", "Version: " + DotNetCoreRunTimeVersions.NetCoreApp70)]
[Trait(TestConstants.Category, TestConstants.Release)] [Trait(TestConstants.Category, TestConstants.Release)]
public void RuntimeImage_Bullseye_HasExecptedDotNetVersion(string version, string expectedOutput) public void RuntimeImage_Bullseye_HasExecptedDotNetVersion(string version, string expectedOutput)
{ {

Просмотреть файл

@ -21,56 +21,56 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData( // [MemberData(
nameof(TestValueGenerator.GetBusterNodeVersions), // nameof(TestValueGenerator.GetBusterNodeVersions),
MemberType = typeof(TestValueGenerator))] // MemberType = typeof(TestValueGenerator))]
public async Task GeneratesScriptForBuster_CanRun_AppInsightsModule_NotFoundAsync(string nodeVersion, string osType) // public async Task GeneratesScriptForBuster_CanRun_AppInsightsModule_NotFoundAsync(string nodeVersion, string osType)
{ // {
// This test is for the following scenario: // // This test is for the following scenario:
// When we find no application insight dependency in package.json, but env variables for // // When we find no application insight dependency in package.json, but env variables for
// configuring application insights has been set in portal // // configuring application insights has been set in portal
// Arrange // // Arrange
var appName = "linxnodeexpress"; // var appName = "linxnodeexpress";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType); // var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType);
var aiConnectionString // var aiConnectionString
= ExtVarNames.UserAppInsightsConnectionStringEnv; // = ExtVarNames.UserAppInsightsConnectionStringEnv;
var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion; // var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand($"export {aiConnectionString}={TestConstants.AppInsightsConnectionString}") // .AddCommand($"export {aiConnectionString}={TestConstants.AppInsightsConnectionString}")
.AddCommand($"export {aIEnabled}=TRUE") // .AddCommand($"export {aIEnabled}=TRUE")
.AddCommand($"cd {appDir}") // .AddCommand($"cd {appDir}")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand($"oryx create-script -appPath {appDir}") // .AddCommand($"oryx create-script -appPath {appDir}")
.AddDirectoryExistsCheck($"{appDir}/node_modules") // .AddDirectoryExistsCheck($"{appDir}/node_modules")
.AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights") // .AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights")
.AddFileExistsCheck($"{FilePaths.NodeGlobalModulesPath}/{FilePaths.NodeAppInsightsLoaderFileName}") // .AddFileExistsCheck($"{FilePaths.NodeGlobalModulesPath}/{FilePaths.NodeAppInsightsLoaderFileName}")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", script }, // runArgs: new[] { "-c", script },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("Hello World from express!", data); // Assert.Contains("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -174,53 +174,53 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
dockerCli: _dockerCli); dockerCli: _dockerCli);
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData( // [MemberData(
nameof(TestValueGenerator.GetBusterNodeVersions), // nameof(TestValueGenerator.GetBusterNodeVersions),
MemberType = typeof(TestValueGenerator))] // MemberType = typeof(TestValueGenerator))]
public async Task GeneratesScriptForBuster_CanRun_With_AppInsights_Env_Variables_NotConfigured_Async(string nodeVersion, string osType) // public async Task GeneratesScriptForBuster_CanRun_With_AppInsights_Env_Variables_NotConfigured_Async(string nodeVersion, string osType)
{ // {
// This test is for the following scenario: // // This test is for the following scenario:
// When we find no application insight dependency in package.json and env variables for // // When we find no application insight dependency in package.json and env variables for
// configuring application insights has not been set properly in portal // // configuring application insights has not been set properly in portal
// Arrange // // Arrange
var appName = "linxnodeexpress"; // var appName = "linxnodeexpress";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType); // var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType);
var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion; // var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand($"export {aIEnabled}=disabled") // .AddCommand($"export {aIEnabled}=disabled")
.AddCommand($"cd {appDir}") // .AddCommand($"cd {appDir}")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand($"oryx create-script -appPath {appDir}") // .AddCommand($"oryx create-script -appPath {appDir}")
.AddDirectoryExistsCheck($"{appDir}/node_modules") // .AddDirectoryExistsCheck($"{appDir}/node_modules")
.AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights") // .AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.AddFileDoesNotExistCheck($"{appDir}/oryx-appinsightsloader.js") // .AddFileDoesNotExistCheck($"{appDir}/oryx-appinsightsloader.js")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", script }, // runArgs: new[] { "-c", script },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("Hello World from express!", data); // Assert.Contains("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -318,57 +318,57 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
dockerCli: _dockerCli); dockerCli: _dockerCli);
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData( // [MemberData(
nameof(TestValueGenerator.GetBusterNodeVersions), // nameof(TestValueGenerator.GetBusterNodeVersions),
MemberType = typeof(TestValueGenerator))] // MemberType = typeof(TestValueGenerator))]
public async Task GeneratesScriptForBuster_CanRun_With_New_AppInsights_Env_Variable_Set_Async(string nodeVersion, string osType) // public async Task GeneratesScriptForBuster_CanRun_With_New_AppInsights_Env_Variable_Set_Async(string nodeVersion, string osType)
{ // {
// This test is for the following scenario: // // This test is for the following scenario:
// When we find the user has set env variable "APPLICATIONINSIGHTS_CONNECTION_STRING" application insight dependency in package.json and env variables for // // When we find the user has set env variable "APPLICATIONINSIGHTS_CONNECTION_STRING" application insight dependency in package.json and env variables for
// configuring application insights has not been set properly in portal // // configuring application insights has not been set properly in portal
// Arrange // // Arrange
var appName = "linxnodeexpress"; // var appName = "linxnodeexpress";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType); // var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, osType);
var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion; // var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion;
var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv; // var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var AppInsightsStartUpLegacyPayLoadMessage = "Application Insights was started with setupString"; // var AppInsightsStartUpLegacyPayLoadMessage = "Application Insights was started with setupString";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand($"export {aIEnabled}=Enabled") // .AddCommand($"export {aIEnabled}=Enabled")
.AddCommand($"export {connectionStringEnv}=alkajsldkajd") // .AddCommand($"export {connectionStringEnv}=alkajsldkajd")
.AddCommand($"cd {appDir}") // .AddCommand($"cd {appDir}")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand($"oryx create-script -appPath {appDir}") // .AddCommand($"oryx create-script -appPath {appDir}")
.AddDirectoryExistsCheck($"{appDir}/node_modules") // .AddDirectoryExistsCheck($"{appDir}/node_modules")
.AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights") // .AddDirectoryDoesNotExistCheck($"{appDir}/node_modules/applicationinsights")
.AddCommand($"./run.sh > {appDir}/log.log") // .AddCommand($"./run.sh > {appDir}/log.log")
.AddFileDoesNotExistCheck($"{appDir}/oryx-appinsightsloader.js") // .AddFileDoesNotExistCheck($"{appDir}/oryx-appinsightsloader.js")
.AddStringDoesNotExistInFileCheck(AppInsightsStartUpLegacyPayLoadMessage, $"{appDir}/log.log") // .AddStringDoesNotExistInFileCheck(AppInsightsStartUpLegacyPayLoadMessage, $"{appDir}/log.log")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", script }, // runArgs: new[] { "-c", script },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("Hello World from express!", data); // Assert.Contains("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -474,109 +474,109 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
dockerCli: _dockerCli); dockerCli: _dockerCli);
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("14", "")] // [InlineData("14", "")]
[InlineData("14", "disabled")] // [InlineData("14", "disabled")]
public async Task GeneratesScriptForBuster_Doesnot_Add_Oryx_AppInsights_Logic_With_IPA_Configuration_Async( // public async Task GeneratesScriptForBuster_Doesnot_Add_Oryx_AppInsights_Logic_With_IPA_Configuration_Async(
string nodeVersion, // string nodeVersion,
string agentExtensionVersionEnvValue) // string agentExtensionVersionEnvValue)
{ // {
// This test is for the following scenario: // // This test is for the following scenario:
// When we find the user has set env variable "ApplicationInsightsAgent_EXTENSION_VERSION" to '~3' // // When we find the user has set env variable "ApplicationInsightsAgent_EXTENSION_VERSION" to '~3'
// Oryx should not attach appinsight codeless config to runscript // // Oryx should not attach appinsight codeless config to runscript
// Arrange // // Arrange
var appName = "linxnodeexpress-appinsights"; // var appName = "linxnodeexpress-appinsights";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBuster); // var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBuster);
//agentextension version will be set to '~3' or '' or 'disabled' // //agentextension version will be set to '~3' or '' or 'disabled'
var agentExtensionVersionEnv = ExtVarNames.UserAppInsightsAgentExtensionVersion; // var agentExtensionVersionEnv = ExtVarNames.UserAppInsightsAgentExtensionVersion;
var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv; // var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js"; // var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand($"export {agentExtensionVersionEnv}={agentExtensionVersionEnvValue}") // .AddCommand($"export {agentExtensionVersionEnv}={agentExtensionVersionEnvValue}")
.AddCommand($"export {connectionStringEnv}=alkajsldkajd") // .AddCommand($"export {connectionStringEnv}=alkajsldkajd")
.AddCommand($"cd {appDir}") // .AddCommand($"cd {appDir}")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand($"oryx create-script -appPath {appDir}") // .AddCommand($"oryx create-script -appPath {appDir}")
.AddDirectoryExistsCheck($"{appDir}/node_modules") // .AddDirectoryExistsCheck($"{appDir}/node_modules")
.AddCommand($"./run.sh > {appDir}/log.log") // .AddCommand($"./run.sh > {appDir}/log.log")
.AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh") // .AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBuster), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBuster),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", script }, // runArgs: new[] { "-c", script },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("AppInsights is not configured!", data); // Assert.Contains("AppInsights is not configured!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] // [Theory]
[Trait("category", "runtime-bullseye")] // [Trait("category", "runtime-bullseye")]
[InlineData("14", "")] // [InlineData("14", "")]
[InlineData("14", "disabled")] // [InlineData("14", "disabled")]
public async Task GeneratesScriptForBullseye_Doesnot_Add_Oryx_AppInsights_Logic_With_IPA_Configuration_Async( // public async Task GeneratesScriptForBullseye_Doesnot_Add_Oryx_AppInsights_Logic_With_IPA_Configuration_Async(
string nodeVersion, // string nodeVersion,
string agentExtensionVersionEnvValue) // string agentExtensionVersionEnvValue)
{ // {
// This test is for the following scenario: // // This test is for the following scenario:
// When we find the user has set env variable "ApplicationInsightsAgent_EXTENSION_VERSION" to '~3' // // When we find the user has set env variable "ApplicationInsightsAgent_EXTENSION_VERSION" to '~3'
// Oryx should not attach appinsight codeless config to runscript // // Oryx should not attach appinsight codeless config to runscript
// Arrange // // Arrange
var appName = "linxnodeexpress-appinsights"; // var appName = "linxnodeexpress-appinsights";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir; // var appDir = volume.ContainerDir;
var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBullseye); // var imageName = _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBullseye);
//agentextension version will be set to '~3' or '' or 'disabled' // //agentextension version will be set to '~3' or '' or 'disabled'
var agentExtensionVersionEnv = ExtVarNames.UserAppInsightsAgentExtensionVersion; // var agentExtensionVersionEnv = ExtVarNames.UserAppInsightsAgentExtensionVersion;
var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv; // var connectionStringEnv = ExtVarNames.UserAppInsightsConnectionStringEnv;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js"; // var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand($"export {agentExtensionVersionEnv}={agentExtensionVersionEnvValue}") // .AddCommand($"export {agentExtensionVersionEnv}={agentExtensionVersionEnvValue}")
.AddCommand($"export {connectionStringEnv}=alkajsldkajd") // .AddCommand($"export {connectionStringEnv}=alkajsldkajd")
.AddCommand($"cd {appDir}") // .AddCommand($"cd {appDir}")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand($"oryx create-script -appPath {appDir}") // .AddCommand($"oryx create-script -appPath {appDir}")
.AddDirectoryExistsCheck($"{appDir}/node_modules") // .AddDirectoryExistsCheck($"{appDir}/node_modules")
.AddCommand($"./run.sh > {appDir}/log.log") // .AddCommand($"./run.sh > {appDir}/log.log")
.AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh") // .AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBullseye), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, ImageTestHelperConstants.OsTypeDebianBullseye),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", script }, // runArgs: new[] { "-c", script },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("AppInsights is not configured!", data); // Assert.Contains("AppInsights is not configured!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
} }
} }

Просмотреть файл

@ -18,26 +18,26 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))]
public void NodeBusterImage_Contains_RequiredPrograms(string version, string osType) // public void NodeBusterImage_Contains_RequiredPrograms(string version, string osType)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, osType), // ImageId = _imageHelper.GetRuntimeImage("node", version, osType),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] // CommandArguments = new[]
{ // {
"-c", // "-c",
"which tar && which unzip && which pm2 && cd /opt/node-wrapper && node --version" // "which tar && which unzip && which pm2 && cd /opt/node-wrapper && node --version"
} // }
}); // });
// Assert // // Assert
RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo()); // RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo());
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -81,78 +81,78 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo()); RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo());
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("14")] // [InlineData("14")]
public void Node14BusterImage_Contains_PM2(string version) // public void Node14BusterImage_Contains_PM2(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] // CommandArguments = new[]
{ // {
"-c", // "-c",
"which pm2" // "which pm2"
} // }
}); // });
// Assert // // Assert
RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo()); // RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-bullseye")] // [Trait("category", "runtime-bullseye")]
[InlineData("14")] // [InlineData("14")]
public void Node14BullseyeImage_Contains_PM2(string version) // public void Node14BullseyeImage_Contains_PM2(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBullseye), // ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] // CommandArguments = new[]
{ // {
"-c", // "-c",
"which pm2" // "which pm2"
} // }
}); // });
// Assert // // Assert
RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo()); // RunAsserts(() => Assert.True(result.IsSuccess), result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))]
public void NodeBusterImage_Contains_ApplicationInsights(string version, string osType) // public void NodeBusterImage_Contains_ApplicationInsights(string version, string osType)
{ // {
// Arrange & Act // // Arrange & Act
var expectedAppInsightsVersion = string.Concat("applicationinsights@", NodeVersions.NodeAppInsightsSdkVersion); // var expectedAppInsightsVersion = string.Concat("applicationinsights@", NodeVersions.NodeAppInsightsSdkVersion);
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, osType), // ImageId = _imageHelper.GetRuntimeImage("node", version, osType),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] // CommandArguments = new[]
{ // {
"-c", // "-c",
"npm list -g applicationinsights" // "npm list -g applicationinsights"
} // }
}); // });
var actualOutput = result.StdOut.ReplaceNewLine(); // var actualOutput = result.StdOut.ReplaceNewLine();
// Assert // // Assert
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains(expectedAppInsightsVersion, actualOutput); // Assert.Contains(expectedAppInsightsVersion, actualOutput);
Assert.Contains("/usr/local/lib", actualOutput); // Assert.Contains("/usr/local/lib", actualOutput);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -216,32 +216,32 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
result.GetDebugInfo()); result.GetDebugInfo());
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))]
public void NodeBusterImages_Contains_Correct_NPM_Version(string version, string osType) // public void NodeBusterImages_Contains_Correct_NPM_Version(string version, string osType)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, osType), // ImageId = _imageHelper.GetRuntimeImage("node", version, osType),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] // CommandArguments = new[]
{ // {
"-c", // "-c",
"npm -v" // "npm -v"
} // }
}); // });
// Assert // // Assert
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains(NodeVersions.NpmVersion, result.StdOut.ReplaceNewLine()); // Assert.Contains(NodeVersions.NpmVersion, result.StdOut.ReplaceNewLine());
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]

Просмотреть файл

@ -18,42 +18,42 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[SkippableTheory] // [SkippableTheory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions), MemberType = typeof(TestValueGenerator))]
public void NodeBusterImage_Contains_VersionAndCommit_Information(string version, string osType) // public void NodeBusterImage_Contains_VersionAndCommit_Information(string version, string osType)
{ // {
// We can't always rely on git commit ID as env variable in case build context is not correctly passed // // We can't always rely on git commit ID as env variable in case build context is not correctly passed
// so we should check agent_os environment variable to know if the build is happening in azure devops agent // // so we should check agent_os environment variable to know if the build is happening in azure devops agent
// or locally, locally we need to skip this test // // or locally, locally we need to skip this test
var agentOS = Environment.GetEnvironmentVariable("AGENT_OS"); // var agentOS = Environment.GetEnvironmentVariable("AGENT_OS");
Skip.If(string.IsNullOrEmpty(agentOS)); // Skip.If(string.IsNullOrEmpty(agentOS));
// Arrange // // Arrange
var gitCommitID = GitHelper.GetCommitID(); // var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); // var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); // var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // // Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, osType), // ImageId = _imageHelper.GetRuntimeImage("node", version, osType),
CommandToExecuteOnRun = "oryx", // CommandToExecuteOnRun = "oryx",
CommandArguments = new[] { "version" } // CommandArguments = new[] { "version" }
}); // });
// Assert // // Assert
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.NotNull(result.StdErr); // Assert.NotNull(result.StdErr);
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdOut); // Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdOut);
Assert.Contains(gitCommitID, result.StdOut); // Assert.Contains(gitCommitID, result.StdOut);
Assert.Contains(expectedOryxVersion, result.StdOut); // Assert.Contains(expectedOryxVersion, result.StdOut);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
@ -68,7 +68,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -105,7 +105,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act

Просмотреть файл

@ -21,37 +21,35 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("14", NodeVersions.Node14Version)] // [InlineData("14", NodeVersions.Node14Version)]
[InlineData("16", NodeVersions.Node16Version)] // [InlineData("16", NodeVersions.Node16Version)]
[Trait(TestConstants.Category, TestConstants.Release)] // [Trait(TestConstants.Category, TestConstants.Release)]
public void NodeVersionMatchesBusterImageName(string version, string nodeVersion) // public void NodeVersionMatchesBusterImageName(string version, string nodeVersion)
{ // {
// Arrange & Act // // Arrange & Act
var expectedNodeVersion = "v" + nodeVersion; // var expectedNodeVersion = "v" + nodeVersion;
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("node", version, ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "node", // CommandToExecuteOnRun = "node",
CommandArguments = new[] { "--version" } // CommandArguments = new[] { "--version" }
}); // });
// Assert // // Assert
var actualOutput = result.StdOut.ReplaceNewLine(); // var actualOutput = result.StdOut.ReplaceNewLine();
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Equal(expectedNodeVersion, actualOutput); // Assert.Equal(expectedNodeVersion, actualOutput);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("14", NodeVersions.Node14Version)]
[InlineData("16", NodeVersions.Node16Version)]
[InlineData("18", NodeVersions.Node18Version)] [InlineData("18", NodeVersions.Node18Version)]
[InlineData("20", NodeVersions.Node20Version)] [InlineData("20", NodeVersions.Node20Version)]
[Trait(TestConstants.Category, TestConstants.Release)] [Trait(TestConstants.Category, TestConstants.Release)]
@ -163,35 +161,35 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
result.GetDebugInfo()); result.GetDebugInfo());
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData( // [MemberData(
nameof(TestValueGenerator.GetBusterNodeVersions), // nameof(TestValueGenerator.GetBusterNodeVersions),
MemberType = typeof(TestValueGenerator))] // MemberType = typeof(TestValueGenerator))]
public void HasExpected_Global_Buster_Node_Module_Path(string nodeVersion, string osType) // public void HasExpected_Global_Buster_Node_Module_Path(string nodeVersion, string osType)
{ // {
// Arrange & Act // // Arrange & Act
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.AddCommand("npm root --quiet -g") // .AddCommand("npm root --quiet -g")
.ToString(); // .ToString();
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // ImageId = _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
CommandToExecuteOnRun = "/bin/bash", // CommandToExecuteOnRun = "/bin/bash",
CommandArguments = new[] { "-c", script } // CommandArguments = new[] { "-c", script }
}); // });
// Assert // // Assert
var actualOutput = result.StdOut.ReplaceNewLine(); // var actualOutput = result.StdOut.ReplaceNewLine();
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains(FilePaths.NodeGlobalModulesPath, actualOutput); // Assert.Contains(FilePaths.NodeGlobalModulesPath, actualOutput);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Fact] [Fact]
@ -211,7 +209,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Act // Act
var result = _dockerCli.Run(new DockerRunArguments var result = _dockerCli.Run(new DockerRunArguments
{ {
ImageId = _imageHelper.GetRuntimeImage("node", "14", ImageTestHelperConstants.OsTypeDebianBullseye), ImageId = _imageHelper.GetRuntimeImage("node", "20", ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "/bin/sh", CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] { "-c", script } CommandArguments = new[] { "-c", script }
}); });
@ -220,44 +218,44 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
RunAsserts(() => Assert.Equal(exitCodeSentinel, result.ExitCode), result.GetDebugInfo()); RunAsserts(() => Assert.Equal(exitCodeSentinel, result.ExitCode), result.GetDebugInfo());
} }
[Theory(Skip = "Investigating debugging using pm2")] // [Theory(Skip = "Investigating debugging using pm2")]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData( // [MemberData(
nameof(TestValueGenerator.GetBusterNodeVersions_SupportDebugging), // nameof(TestValueGenerator.GetBusterNodeVersions_SupportDebugging),
MemberType = typeof(TestValueGenerator))] // MemberType = typeof(TestValueGenerator))]
public async Task RunBusterNodeAppUsingProcessJson_withDebuggingAsync(string nodeVersion, string osType) // public async Task RunBusterNodeAppUsingProcessJson_withDebuggingAsync(string nodeVersion, string osType)
{ // {
var appName = "express-process-json"; // var appName = "express-process-json";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var dir = volume.ContainerDir; // var dir = volume.ContainerDir;
int containerDebugPort = 8080; // int containerDebugPort = 8080;
var runAppScript = new ShellScriptBuilder() // var runAppScript = new ShellScriptBuilder()
.AddCommand($"cd {dir}/app") // .AddCommand($"cd {dir}/app")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand("cd ..") // .AddCommand("cd ..")
.AddCommand($"oryx create-script -remoteDebug -debugPort={containerDebugPort}") // .AddCommand($"oryx create-script -remoteDebug -debugPort={containerDebugPort}")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
port: containerDebugPort, // port: containerDebugPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", runAppScript }, // runArgs: new[] { "-c", runAppScript },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Contains("Say It Again", data); // Assert.Contains("Say It Again", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory(Skip = "Investigating debugging using pm2")] [Theory(Skip = "Investigating debugging using pm2")]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]

Просмотреть файл

@ -21,43 +21,43 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))]
public async Task RunBusterNodeAppUsingConfigJsAsync(string nodeVersion, string osType) // public async Task RunBusterNodeAppUsingConfigJsAsync(string nodeVersion, string osType)
{ // {
var appName = "express-config-js"; // var appName = "express-config-js";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var dir = volume.ContainerDir; // var dir = volume.ContainerDir;
int containerPort = 80; // int containerPort = 80;
var runAppScript = new ShellScriptBuilder() // var runAppScript = new ShellScriptBuilder()
.AddCommand($"cd {dir}/app") // .AddCommand($"cd {dir}/app")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand("cd ..") // .AddCommand("cd ..")
.AddCommand($"oryx create-script -bindPort {containerPort} -usePM2") // .AddCommand($"oryx create-script -bindPort {containerPort} -usePM2")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
containerPort, // containerPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", runAppScript }, // runArgs: new[] { "-c", runAppScript },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal("Hello World from express!", data); // Assert.Equal("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]

Просмотреть файл

@ -21,42 +21,42 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))]
public async Task RunBusterNodeAppUsingConfigYmlAsync(string nodeVersion, string osType) // public async Task RunBusterNodeAppUsingConfigYmlAsync(string nodeVersion, string osType)
{ // {
var appName = "express-config-yaml"; // var appName = "express-config-yaml";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var dir = volume.ContainerDir; // var dir = volume.ContainerDir;
int containerPort = 80; // int containerPort = 80;
var runAppScript = new ShellScriptBuilder() // var runAppScript = new ShellScriptBuilder()
.AddCommand($"cd {dir}/app") // .AddCommand($"cd {dir}/app")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand("cd ..") // .AddCommand("cd ..")
.AddCommand($"oryx create-script -bindPort {containerPort} -userStartupCommand config.yml -usePM2") // .AddCommand($"oryx create-script -bindPort {containerPort} -userStartupCommand config.yml -usePM2")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
containerPort, // containerPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", runAppScript }, // runArgs: new[] { "-c", runAppScript },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal("Hello World from express!", data); // Assert.Equal("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]

Просмотреть файл

@ -21,43 +21,43 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))] // [MemberData(nameof(TestValueGenerator.GetBusterNodeVersions_SupportPm2), MemberType = typeof(TestValueGenerator))]
public async Task RunBusterNodeAppUsingProcessJson(string nodeVersion, string osType) // public async Task RunBusterNodeAppUsingProcessJson(string nodeVersion, string osType)
{ // {
var appName = "express-process-json"; // var appName = "express-process-json";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName); // var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir); // var volume = DockerVolume.CreateMirror(hostDir);
var dir = volume.ContainerDir; // var dir = volume.ContainerDir;
int containerPort = 80; // int containerPort = 80;
var runAppScript = new ShellScriptBuilder() // var runAppScript = new ShellScriptBuilder()
.AddCommand($"cd {dir}/app") // .AddCommand($"cd {dir}/app")
.AddCommand("npm install") // .AddCommand("npm install")
.AddCommand("cd ..") // .AddCommand("cd ..")
.AddCommand($"oryx create-script -bindPort {containerPort} -usePM2") // .AddCommand($"oryx create-script -bindPort {containerPort} -usePM2")
.AddCommand("./run.sh") // .AddCommand("./run.sh")
.ToString(); // .ToString();
await EndToEndTestHelper.RunAndAssertAppAsync( // await EndToEndTestHelper.RunAndAssertAppAsync(
imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType), // imageName: _imageHelper.GetRuntimeImage("node", nodeVersion, osType),
output: _output, // output: _output,
volumes: new List<DockerVolume> { volume }, // volumes: new List<DockerVolume> { volume },
environmentVariables: null, // environmentVariables: null,
containerPort, // containerPort,
link: null, // link: null,
runCmd: "/bin/sh", // runCmd: "/bin/sh",
runArgs: new[] { "-c", runAppScript }, // runArgs: new[] { "-c", runAppScript },
assertAction: async (hostPort) => // assertAction: async (hostPort) =>
{ // {
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); // var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal("Hello World from express!", data); // Assert.Equal("Hello World from express!", data);
}, // },
dockerCli: _dockerCli); // dockerCli: _dockerCli);
} // }
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]

Просмотреть файл

@ -39,8 +39,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4-fpm", PhpVersions.Php74Version)] // [InlineData("7.4-fpm", PhpVersions.Php74Version)]
[InlineData("8.0-fpm", PhpVersions.Php80Version)] // [InlineData("8.0-fpm", PhpVersions.Php80Version)]
[InlineData("8.1-fpm", PhpVersions.Php81Version)] [InlineData("8.1-fpm", PhpVersions.Php81Version)]
[InlineData("8.2-fpm", PhpVersions.Php82Version)] [InlineData("8.2-fpm", PhpVersions.Php82Version)]
[InlineData("8.3-fpm", PhpVersions.Php83Version)] [InlineData("8.3-fpm", PhpVersions.Php83Version)]
@ -65,8 +65,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4-fpm", PhpVersions.Php74Version)] // [InlineData("7.4-fpm", PhpVersions.Php74Version)]
[InlineData("8.0-fpm", PhpVersions.Php80Version)] // [InlineData("8.0-fpm", PhpVersions.Php80Version)]
[InlineData("8.1-fpm", PhpVersions.Php81Version)] [InlineData("8.1-fpm", PhpVersions.Php81Version)]
[InlineData("8.2-fpm", PhpVersions.Php82Version)] [InlineData("8.2-fpm", PhpVersions.Php82Version)]
[InlineData("8.3-fpm", PhpVersions.Php83Version)] [InlineData("8.3-fpm", PhpVersions.Php83Version)]
@ -113,8 +113,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -138,8 +138,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -182,58 +182,58 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value); Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value);
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
public void MySqlnd_Azure_IsInstalled_For_Buster(string version) // public void MySqlnd_Azure_IsInstalled_For_Buster(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "php", // CommandToExecuteOnRun = "php",
CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" } // CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" }
}); // });
// Assert // // Assert
var output = result.StdOut.ToString(); // var output = result.StdOut.ToString();
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains("mysqlnd_azure", output); // Assert.Contains("mysqlnd_azure", output);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-bullseye")] // [Trait("category", "runtime-bullseye")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version) // public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBullseye), // ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "php", // CommandToExecuteOnRun = "php",
CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" } // CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" }
}); // });
// Assert // // Assert
var output = result.StdOut.ToString(); // var output = result.StdOut.ToString();
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains("mysqlnd_azure", output); // Assert.Contains("mysqlnd_azure", output);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -247,7 +247,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -273,8 +273,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -288,7 +288,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -325,7 +325,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -351,8 +351,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -379,8 +379,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4-fpm")] // [InlineData("7.4-fpm")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -431,7 +431,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]
@ -457,7 +457,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("8.0-fpm")] // [InlineData("8.0-fpm")]
[InlineData("8.1-fpm")] [InlineData("8.1-fpm")]
[InlineData("8.2-fpm")] [InlineData("8.2-fpm")]
[InlineData("8.3-fpm")] [InlineData("8.3-fpm")]

Просмотреть файл

@ -41,8 +41,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4", PhpVersions.Php74Version)] // [InlineData("7.4", PhpVersions.Php74Version)]
[InlineData("8.0", PhpVersions.Php80Version)] // [InlineData("8.0", PhpVersions.Php80Version)]
[InlineData("8.1", PhpVersions.Php81Version)] [InlineData("8.1", PhpVersions.Php81Version)]
[InlineData("8.2", PhpVersions.Php82Version)] [InlineData("8.2", PhpVersions.Php82Version)]
[InlineData("8.3", PhpVersions.Php83Version)] [InlineData("8.3", PhpVersions.Php83Version)]
@ -67,8 +67,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4", PhpVersions.Php74Version)] // [InlineData("7.4", PhpVersions.Php74Version)]
[InlineData("8.0", PhpVersions.Php80Version)] // [InlineData("8.0", PhpVersions.Php80Version)]
[InlineData("8.1", PhpVersions.Php81Version)] [InlineData("8.1", PhpVersions.Php81Version)]
[InlineData("8.2", PhpVersions.Php82Version)] [InlineData("8.2", PhpVersions.Php82Version)]
[InlineData("8.3", PhpVersions.Php83Version)] [InlineData("8.3", PhpVersions.Php83Version)]
@ -115,8 +115,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -141,8 +141,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -189,8 +189,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -262,8 +262,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -404,8 +404,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -432,8 +432,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -482,58 +482,58 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
} }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
public void MySqlnd_Azure_IsInstalled_For_Buster(string version) // public void MySqlnd_Azure_IsInstalled_For_Buster(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "php", // CommandToExecuteOnRun = "php",
CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" } // CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" }
}); // });
// Assert // // Assert
var output = result.StdOut.ToString(); // var output = result.StdOut.ToString();
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains("mysqlnd_azure", output); // Assert.Contains("mysqlnd_azure", output);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-bullseye")] // [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version) // public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBullseye), // ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "php", // CommandToExecuteOnRun = "php",
CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" } // CommandArguments = new[] { "-m", " | grep mysqlnd_azure);" }
}); // });
// Assert // // Assert
var output = result.StdOut.ToString(); // var output = result.StdOut.ToString();
RunAsserts(() => // RunAsserts(() =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains("mysqlnd_azure", output); // Assert.Contains("mysqlnd_azure", output);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -547,7 +547,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -573,8 +573,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -588,7 +588,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -614,8 +614,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -642,8 +642,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("7.4")] // [InlineData("7.4")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -670,7 +670,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]
@ -697,7 +697,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("8.0")] // [InlineData("8.0")]
[InlineData("8.1")] [InlineData("8.1")]
[InlineData("8.2")] [InlineData("8.2")]
[InlineData("8.3")] [InlineData("8.3")]

Просмотреть файл

@ -20,7 +20,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.7")]
[InlineData("3.8")] [InlineData("3.8")]
[InlineData("3.9")] [InlineData("3.9")]
[InlineData("3.10")] [InlineData("3.10")]
@ -34,7 +33,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -60,7 +59,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[SkippableTheory] [SkippableTheory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.7")]
[InlineData("3.8")] [InlineData("3.8")]
[InlineData("3.9")] [InlineData("3.9")]
[InlineData("3.10")] [InlineData("3.10")]
@ -76,7 +74,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -117,7 +115,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Arrange // Arrange
var gitCommitID = GitHelper.GetCommitID(); var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // Act
@ -143,7 +141,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.7")]
[InlineData("3.8")] [InlineData("3.8")]
[InlineData("3.9")] [InlineData("3.9")]
[InlineData("3.10")] [InlineData("3.10")]
@ -172,7 +169,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.7")]
[InlineData("3.8")] [InlineData("3.8")]
[InlineData("3.9")] [InlineData("3.9")]
[InlineData("3.10")] [InlineData("3.10")]
@ -262,7 +258,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-bullseye")] [Trait("category", "runtime-bullseye")]
[InlineData("3.7", "Python " + PythonVersions.Python37Version)]
[InlineData("3.8", "Python " + PythonVersions.Python38Version)] [InlineData("3.8", "Python " + PythonVersions.Python38Version)]
[InlineData("3.9", "Python " + PythonVersions.Python39Version)] [InlineData("3.9", "Python " + PythonVersions.Python39Version)]
[InlineData("3.10", "Python " + PythonVersions.Python310Version)] [InlineData("3.10", "Python " + PythonVersions.Python310Version)]
@ -292,7 +287,6 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
[Theory] [Theory]
[Trait("category", "runtime-buster")] [Trait("category", "runtime-buster")]
[InlineData("3.7", "Python " + PythonVersions.Python37Version)]
[InlineData("3.8", "Python " + PythonVersions.Python38Version)] [InlineData("3.8", "Python " + PythonVersions.Python38Version)]
[InlineData("3.9", "Python " + PythonVersions.Python39Version)] [InlineData("3.9", "Python " + PythonVersions.Python39Version)]
[InlineData("3.10", "Python " + PythonVersions.Python310Version)] [InlineData("3.10", "Python " + PythonVersions.Python310Version)]
@ -335,7 +329,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
// Act // Act
var result = _dockerCli.Run(new DockerRunArguments var result = _dockerCli.Run(new DockerRunArguments
{ {
ImageId = _imageHelper.GetRuntimeImage("python", "3.7", ImageTestHelperConstants.OsTypeDebianBullseye), ImageId = _imageHelper.GetRuntimeImage("python", "3.11", ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "/bin/sh", CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] { "-c", script } CommandArguments = new[] { "-c", script }
}); });

Просмотреть файл

@ -18,120 +18,120 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
{ {
} }
[SkippableFact] // [SkippableFact]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
public void RubyRuntimeImage_Contains_VersionAndCommit_Information() // public void RubyRuntimeImage_Contains_VersionAndCommit_Information()
{ // {
// we cant always rely on gitcommitid as env variable in case build context is not correctly passed // // we cant always rely on gitcommitid as env variable in case build context is not correctly passed
// so we should check agent_os environment variable to know if the build is happening in azure devops agent // // so we should check agent_os environment variable to know if the build is happening in azure devops agent
// or locally, locally we need to skip this test // // or locally, locally we need to skip this test
var agentOS = Environment.GetEnvironmentVariable("AGENT_OS"); // var agentOS = Environment.GetEnvironmentVariable("AGENT_OS");
Skip.If(string.IsNullOrEmpty(agentOS)); // Skip.If(string.IsNullOrEmpty(agentOS));
// Arrange // // Arrange
var gitCommitID = GitHelper.GetCommitID(); // var gitCommitID = GitHelper.GetCommitID();
var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); // var buildNumber = Environment.GetEnvironmentVariable("IMAGE_BUILDNUMBER");
var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); // var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber);
// Act // // Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("ruby", "dynamic", ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("ruby", "dynamic", ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "oryx", // CommandToExecuteOnRun = "oryx",
CommandArguments = new[] { "version" } // CommandArguments = new[] { "version" }
}); // });
// Assert // // Assert
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.NotNull(result.StdErr); // Assert.NotNull(result.StdErr);
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdOut); // Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdOut);
Assert.Contains(gitCommitID, result.StdOut); // Assert.Contains(gitCommitID, result.StdOut);
Assert.Contains(expectedOryxVersion, result.StdOut); // Assert.Contains(expectedOryxVersion, result.StdOut);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Fact] // [Fact]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
public void GeneratedScript_CanRunStartupScriptsFromAppRoot() // public void GeneratedScript_CanRunStartupScriptsFromAppRoot()
{ // {
// Arrange // // Arrange
const int exitCodeSentinel = 222; // const int exitCodeSentinel = 222;
var appPath = "/tmp/app"; // var appPath = "/tmp/app";
var script = new ShellScriptBuilder() // var script = new ShellScriptBuilder()
.CreateDirectory(appPath) // .CreateDirectory(appPath)
.CreateFile(appPath + "/entry.sh", $"exit {exitCodeSentinel}") // .CreateFile(appPath + "/entry.sh", $"exit {exitCodeSentinel}")
.AddCommand("oryx create-script -userStartupCommand entry.sh -appPath " + appPath) // .AddCommand("oryx create-script -userStartupCommand entry.sh -appPath " + appPath)
.AddCommand(". ./run.sh") // Source the default output path // .AddCommand(". ./run.sh") // Source the default output path
.ToString(); // .ToString();
// Act // // Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("ruby", "dynamic", ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("ruby", "dynamic", ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "/bin/sh", // CommandToExecuteOnRun = "/bin/sh",
CommandArguments = new[] { "-c", script } // CommandArguments = new[] { "-c", script }
}); // });
// Assert // // Assert
RunAsserts(() => Assert.Equal(exitCodeSentinel, result.ExitCode), result.GetDebugInfo()); // RunAsserts(() => Assert.Equal(exitCodeSentinel, result.ExitCode), result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-buster")] // [Trait("category", "runtime-buster")]
[InlineData("2.5", "ruby " + RubyVersions.Ruby25Version)] // [InlineData("2.5", "ruby " + RubyVersions.Ruby25Version)]
[InlineData("2.6", "ruby " + RubyVersions.Ruby26Version)] // [InlineData("2.6", "ruby " + RubyVersions.Ruby26Version)]
[InlineData("2.7", "ruby " + RubyVersions.Ruby27Version)] // [InlineData("2.7", "ruby " + RubyVersions.Ruby27Version)]
[Trait(TestConstants.Category, TestConstants.Release)] // [Trait(TestConstants.Category, TestConstants.Release)]
public void RubyVersionMatchesBusterImageName(string rubyVersion, string expectedOutput) // public void RubyVersionMatchesBusterImageName(string rubyVersion, string expectedOutput)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("ruby", rubyVersion, ImageTestHelperConstants.OsTypeDebianBuster), // ImageId = _imageHelper.GetRuntimeImage("ruby", rubyVersion, ImageTestHelperConstants.OsTypeDebianBuster),
CommandToExecuteOnRun = "ruby", // CommandToExecuteOnRun = "ruby",
CommandArguments = new[] { "--version" } // CommandArguments = new[] { "--version" }
}); // });
// Assert // // Assert
var actualOutput = result.StdOut.ReplaceNewLine(); // var actualOutput = result.StdOut.ReplaceNewLine();
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains(expectedOutput, actualOutput); // Assert.Contains(expectedOutput, actualOutput);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
[Theory] // [Theory]
[Trait("category", "runtime-bullseye")] // [Trait("category", "runtime-bullseye")]
[InlineData("2.5", "ruby " + RubyVersions.Ruby25Version)] // [InlineData("2.5", "ruby " + RubyVersions.Ruby25Version)]
[InlineData("2.6", "ruby " + RubyVersions.Ruby26Version)] // [InlineData("2.6", "ruby " + RubyVersions.Ruby26Version)]
[InlineData("2.7", "ruby " + RubyVersions.Ruby27Version)] // [InlineData("2.7", "ruby " + RubyVersions.Ruby27Version)]
[Trait(TestConstants.Category, TestConstants.Release)] // [Trait(TestConstants.Category, TestConstants.Release)]
public void RubyVersionMatchesBullseyeImageName(string rubyVersion, string expectedOutput) // public void RubyVersionMatchesBullseyeImageName(string rubyVersion, string expectedOutput)
{ // {
// Arrange & Act // // Arrange & Act
var result = _dockerCli.Run(new DockerRunArguments // var result = _dockerCli.Run(new DockerRunArguments
{ // {
ImageId = _imageHelper.GetRuntimeImage("ruby", rubyVersion, ImageTestHelperConstants.OsTypeDebianBullseye), // ImageId = _imageHelper.GetRuntimeImage("ruby", rubyVersion, ImageTestHelperConstants.OsTypeDebianBullseye),
CommandToExecuteOnRun = "ruby", // CommandToExecuteOnRun = "ruby",
CommandArguments = new[] { "--version" } // CommandArguments = new[] { "--version" }
}); // });
// Assert // // Assert
var actualOutput = result.StdOut.ReplaceNewLine(); // var actualOutput = result.StdOut.ReplaceNewLine();
RunAsserts( // RunAsserts(
() => // () =>
{ // {
Assert.True(result.IsSuccess); // Assert.True(result.IsSuccess);
Assert.Contains(expectedOutput, actualOutput); // Assert.Contains(expectedOutput, actualOutput);
}, // },
result.GetDebugInfo()); // result.GetDebugInfo());
} // }
} }
} }

Просмотреть файл

@ -16,24 +16,12 @@ namespace Microsoft.Oryx.Tests.Common
{ {
/// <summary> /// <summary>
/// This method adds environment variables for the staging storage to a collection. /// This method adds environment variables for the staging storage to a collection.
/// It adds the URL of the staging storage and the sasToken to access the storage. /// It adds the URL of the staging storage.
/// </summary> /// </summary>
/// <param name="envVarList"> A Collection of EnvironmentVariable objects. The storage environment variables are be added here</param> /// <param name="envVarList"> A Collection of EnvironmentVariable objects. The storage environment variables are be added here</param>
/// <returns>The method returns the collection with the newly added environment variables.</returns> /// <returns>The method returns the collection with the newly added environment variables.</returns>
public static ICollection<EnvironmentVariable> AddTestStorageAccountEnvironmentVariables(this ICollection<EnvironmentVariable> envVarList) public static ICollection<EnvironmentVariable> AddTestStorageAccountEnvironmentVariables(this ICollection<EnvironmentVariable> envVarList)
{ {
var testStorageAccountUrl = Environment.GetEnvironmentVariable(SdkStorageConstants.TestingSdkStorageUrlKeyName);
var sdkStorageUrl = string.IsNullOrEmpty(testStorageAccountUrl) ? SdkStorageConstants.PrivateStagingSdkStorageBaseUrl : testStorageAccountUrl;
envVarList.Add(new EnvironmentVariable(SdkStorageConstants.SdkStorageBaseUrlKeyName, sdkStorageUrl));
if (sdkStorageUrl == SdkStorageConstants.PrivateStagingSdkStorageBaseUrl)
{
string stagingStorageSasToken = Environment.GetEnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey) ??
KeyVaultHelper.GetKeyVaultSecretValue(SdkStorageConstants.OryxKeyvaultUri, SdkStorageConstants.StagingStorageSasTokenKeyvaultSecretName);
envVarList.Add(new EnvironmentVariable(SdkStorageConstants.PrivateStagingStorageSasTokenKey, stagingStorageSasToken));
}
return envVarList; return envVarList;
} }
} }

Просмотреть файл

@ -15,18 +15,7 @@ namespace Microsoft.Oryx.Tests.Common
{ {
public static string GetCommitID() public static string GetCommitID()
{ {
var workingDirectory = (new FileInfo(Assembly.GetExecutingAssembly().Location)).Directory.FullName; return Environment.GetEnvironmentVariable("GIT_COMMIT");
(int exitCode, string output, string error) = ProcessHelper.RunProcess(
"git",
new[] { "rev-parse", "HEAD" },
workingDirectory,
waitTimeForExit: TimeSpan.FromSeconds(10));
Assert.Equal(0, exitCode);
var gitCommitID = output.Trim().ReplaceNewLine();
return gitCommitID;
} }
} }
} }

Просмотреть файл

@ -312,28 +312,19 @@ namespace Microsoft.Oryx.Tests.Common
/// <returns>A 'build:slim' image that can be pulled for testing.</returns> /// <returns>A 'build:slim' image that can be pulled for testing.</returns>
public string GetAzureFunctionsJamStackBuildImage(string buildImageTag = null) public string GetAzureFunctionsJamStackBuildImage(string buildImageTag = null)
{ {
if (!string.IsNullOrEmpty(buildImageTag) if (!string.IsNullOrEmpty(buildImageTag) && string.Equals(buildImageTag.ToLower(), _azureFunctionsJamStackBullseye))
&& string.Equals(buildImageTag.ToLower(), _azureFunctionsJamStackBuster))
{
return $"{_repoPrefix}/{_buildRepository}:{_azureFunctionsJamStackBuster}{_tagSuffix}";
}
else if (!string.IsNullOrEmpty(buildImageTag) && string.Equals(buildImageTag.ToLower(), _azureFunctionsJamStackBullseye))
{ {
return $"{_repoPrefix}/{_buildRepository}:{_azureFunctionsJamStackBullseye}{_tagSuffix}"; return $"{_repoPrefix}/{_buildRepository}:{_azureFunctionsJamStackBullseye}{_tagSuffix}";
} }
else else
{ {
return $"{_repoPrefix}/{_buildRepository}:{_azureFunctionsJamStackStretch}{_tagSuffix}"; return $"{_repoPrefix}/{_buildRepository}:{_azureFunctionsJamStackBuster}{_tagSuffix}";
} }
} }
public string GetGitHubActionsBuildImage(string buildImageTag = null) public string GetGitHubActionsBuildImage(string buildImageTag = null)
{ {
if (!string.IsNullOrEmpty(buildImageTag) && string.Equals(buildImageTag.ToLower(), _gitHubActionsBuster)) if (!string.IsNullOrEmpty(buildImageTag) && string.Equals(buildImageTag.ToLower(), _gitHubActionsBookworm))
{
return $"{_repoPrefix}/{_buildRepository}:{_gitHubActionsBuster}{_tagSuffix}";
}
else if (!string.IsNullOrEmpty(buildImageTag) && string.Equals(buildImageTag.ToLower(), _gitHubActionsBookworm))
{ {
return $"{_repoPrefix}/{_buildRepository}:{_gitHubActionsBookworm}{_tagSuffix}"; return $"{_repoPrefix}/{_buildRepository}:{_gitHubActionsBookworm}{_tagSuffix}";
} }
@ -343,7 +334,7 @@ namespace Microsoft.Oryx.Tests.Common
} }
else else
{ {
return $"{_repoPrefix}/{_buildRepository}:{_gitHubActionsStretch}{_tagSuffix}"; return $"{_repoPrefix}/{_buildRepository}:{_gitHubActionsBuster}{_tagSuffix}";
} }
} }

Просмотреть файл

@ -12,10 +12,9 @@ namespace Microsoft.Oryx.Tests.Common
{ {
private readonly static List<(string Version, string OsType)> NodeVersions = new List<(string, string)> private readonly static List<(string Version, string OsType)> NodeVersions = new List<(string, string)>
{ {
("14", ImageTestHelperConstants.OsTypeDebianBuster), ("18", ImageTestHelperConstants.OsTypeDebianBullseye),
("14", ImageTestHelperConstants.OsTypeDebianBullseye), ("20", ImageTestHelperConstants.OsTypeDebianBullseye),
("16", ImageTestHelperConstants.OsTypeDebianBuster), ("20", ImageTestHelperConstants.OsTypeDebianBookworm)
("16", ImageTestHelperConstants.OsTypeDebianBullseye)
}; };
private readonly static List<(string Version, string OsType)> NodeBusterVersions = new List<(string, string)> private readonly static List<(string Version, string OsType)> NodeBusterVersions = new List<(string, string)>
@ -26,8 +25,6 @@ namespace Microsoft.Oryx.Tests.Common
private readonly static List<(string Version, string OsType)> NodeBullseyeVersions = new List<(string, string)> private readonly static List<(string Version, string OsType)> NodeBullseyeVersions = new List<(string, string)>
{ {
("14", ImageTestHelperConstants.OsTypeDebianBullseye),
("16", ImageTestHelperConstants.OsTypeDebianBullseye),
("18", ImageTestHelperConstants.OsTypeDebianBullseye), ("18", ImageTestHelperConstants.OsTypeDebianBullseye),
("20", ImageTestHelperConstants.OsTypeDebianBullseye) ("20", ImageTestHelperConstants.OsTypeDebianBullseye)
}; };

Просмотреть файл

@ -1,4 +1,5 @@
FROM oryxdevmcr.azurecr.io/public/oryx/build:debian-stretch ARG PARENT_IMAGE_BASE
FROM ${PARENT_IMAGE_BASE}
# Following is a pattern that AppService currently uses # Following is a pattern that AppService currently uses
RUN groupadd -g 1002 oryx_group RUN groupadd -g 1002 oryx_group

Просмотреть файл

@ -1,5 +1,5 @@
ARG PARENT_IMAGE_BASE ARG PARENT_IMAGE_BASE
FROM oryxdevmcr.azurecr.io/public/oryx/build:${PARENT_IMAGE_BASE} FROM ${PARENT_IMAGE_BASE}
# Following is a pattern that AppService currently uses # Following is a pattern that AppService currently uses
RUN groupadd -g 1002 oryx_group RUN groupadd -g 1002 oryx_group

Просмотреть файл

@ -1,43 +1,30 @@
parameters: parameters:
destinationSdkStorageAccountName: 'oryxsdksstaging' - name: sourceFolder
type: string
- name: storageAccountName
type: string
- name: subscription
type: string
steps: steps:
- checkout: self - task: AzureCLI@2
clean: true
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
artifactName: drop
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection - OSS Compliance'
inputs:
ignoreDirectories: '$(Build.SourcesDirectory)/tests'
- task: ShellScript@2
displayName: Upload files to Azure Storage displayName: Upload files to Azure Storage
env:
DEV_STORAGE_SAS_TOKEN: $(DEV-STORAGE-SAS-TOKEN)
ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN: $(ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN)
SANDBOX_STORAGE_SAS_TOKEN: $(SANDBOX-STORAGE-SAS-TOKEN)
PERSONAL_STORAGE_SAS_TOKEN: $(${{ upper(parameters.destinationSdkStorageAccountName) }}-PERSONAL-STORAGE-SAS-TOKEN)
PRIVATE_STORAGE_SAS_TOKEN: $(ORYX-SDK-PRIVATE-SAS-TOKEN)
inputs: inputs:
scriptPath: ./vsts/scripts/publishFilesToAzureStorage.sh azureSubscription: ${{ parameters.subscription }}
args: ${{ parameters.destinationSdkStorageAccountName }} scriptPath: ${{ parameters.sourceFolder }}/vsts/scripts/publishFilesToAzureStorage.sh
arguments: ${{ parameters.storageAccountName }}
scriptType: 'bash'
- task: UseDotNet@2 - task: UseDotNet@2
displayName: 'Use .NET Core SDK 7.x' displayName: 'Use .NET Core SDK 7.x'
inputs: inputs:
version: 7.0.306 version: 7.x
- task: ShellScript@2 - task: ShellScript@2
displayName: 'Test Dev storage account' displayName: 'Test Dev storage account'
env: env:
ORYX_TEST_SDK_STORAGE_URL: https://${{ parameters.destinationSdkStorageAccountName }}.blob.core.windows.net ORYX_TEST_SDK_STORAGE_URL: https://${{ parameters.storageAccountName }}.blob.core.windows.net
ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN: $(ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN)
inputs: inputs:
scriptPath: ./build/testIntegration.sh scriptPath: ${{ parameters.sourceFolder }}/build/testIntegration.sh
args: StorageAccountTests=Dev args: StorageAccountTests=Dev

Просмотреть файл

@ -1,42 +1,26 @@
parameters: parameters:
platformName: '' - name: platformName
debianFlavor: '' type: string
destinationSdkStorageAccountName: '' - name: debianFlavor
type: string
steps: - name: sourceFolder
- checkout: self type: string
clean: true - name: storageAccountName
type: string
- name: dotnetPrivateStorageSasToken
type: string
default: ''
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 steps:
displayName: 'Component Detection - OSS Compliance'
inputs:
ignoreDirectories: '$(Build.SourcesDirectory)/tests'
- task: UseDotNet@2 - task: UseDotNet@2
displayName: 'Use .NET Core sdk 7.x' displayName: 'Use .NET Core sdk 7.x'
inputs: inputs:
version: 7.0.306 version: 7.x
- task: ShellScript@2 - task: ShellScript@2
displayName: 'Building platform binaries' displayName: 'Building platform binaries'
env: env:
ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN: $(ORYX-SDK-STAGING-PRIVATE-SAS-TOKEN) DOTNET_PRIVATE_STORAGE_ACCOUNT_ACCESS_TOKEN: ${{ parameters.dotnetPrivateStorageSasToken }}
DOTNET_PRIVATE_STORAGE_ACCOUNT_ACCESS_TOKEN: $(DotnetPrivateStorageAccountAccessToken)
inputs: inputs:
scriptPath: ./build/buildPlatformBinaries.sh scriptPath: ${{ parameters.sourceFolder }}/build/buildPlatformBinaries.sh
args: ${{ parameters.platformName }} ${{ parameters.debianFlavor }} https://${{ parameters.destinationSdkStorageAccountName }}.blob.core.windows.net args: ${{ parameters.platformName }} ${{ parameters.debianFlavor }} https://${{ parameters.storageAccountName }}.blob.core.windows.net
- task: CopyFiles@2
displayName: 'Copy artifacts from source repo to agent artifacts folder'
inputs:
sourceFolder: '$(Build.SourcesDirectory)/artifacts'
contents: '**/*.*'
targetFolder: $(Build.ArtifactStagingDirectory)
overWrite: true
condition: true
- task: PublishBuildArtifacts@1
displayName: Publish build artifacts
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
condition: true

Просмотреть файл

@ -8,12 +8,12 @@ set -e
declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && cd .. && pwd ) declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && cd .. && pwd )
source $REPO_DIR/platforms/__common.sh source $REPO_DIR/platforms/__common.sh
commit=$(git rev-parse HEAD) commit=$GIT_COMMIT
storageAccountName="$1" storageAccountName="$1"
uploadFiles() { uploadFiles() {
local platform="$1" local platform="$1"
local artifactsDir="$BUILD_ARTIFACTSTAGINGDIRECTORY/drop/platformSdks/$platform" local artifactsDir="$ARTIFACTS_DIR/platformSdks/$platform"
if [ ! -d "$artifactsDir" ]; then if [ ! -d "$artifactsDir" ]; then
return return
fi fi
@ -47,7 +47,6 @@ uploadFiles() {
--file "$fileToUpload" \ --file "$fileToUpload" \
--container-name $platform \ --container-name $platform \
--account-name $storageAccountName \ --account-name $storageAccountName \
--sas-token $sasToken \
--metadata \ --metadata \
Buildnumber="$BUILD_BUILDNUMBER" \ Buildnumber="$BUILD_BUILDNUMBER" \
Commit="$commit" \ Commit="$commit" \
@ -61,7 +60,6 @@ uploadFiles() {
--file "$fileToUpload" \ --file "$fileToUpload" \
--container-name $platform \ --container-name $platform \
--account-name $storageAccountName \ --account-name $storageAccountName \
--sas-token $sasToken \
--metadata \ --metadata \
Buildnumber="$BUILD_BUILDNUMBER" \ Buildnumber="$BUILD_BUILDNUMBER" \
Commit="$commit" \ Commit="$commit" \
@ -73,28 +71,6 @@ uploadFiles() {
} }
storageAccountUrl="https://$storageAccountName.blob.core.windows.net" storageAccountUrl="https://$storageAccountName.blob.core.windows.net"
sasToken=""
set +x
# case insensitive matching because both secrets and urls are case insensitive
shopt -s nocasematch
if [[ "$storageAccountUrl" == $SANDBOX_SDK_STORAGE_BASE_URL ]]; then
sasToken=$SANDBOX_STORAGE_SAS_TOKEN
elif [[ "$storageAccountUrl" == $DEV_SDK_STORAGE_BASE_URL ]]; then
sasToken=$DEV_STORAGE_SAS_TOKEN
elif [[ "$storageAccountUrl" == $PRIVATE_STAGING_SDK_STORAGE_BASE_URL ]]; then
sasToken=$ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN
elif [[ "$storageAccountUrl" == $PRIVATE_SDK_STORAGE_BASE_URL ]]; then
sasToken=$PRIVATE_STORAGE_SAS_TOKEN
# check if the personal sas token has been found in the oryx key vault
elif [[ "$PERSONAL_STORAGE_SAS_TOKEN" != "\$($storageAccountName-PERSONAL-STORAGE-SAS-TOKEN)" ]]; then
sasToken=$PERSONAL_STORAGE_SAS_TOKEN
else
echo "Error: $storageAccountUrl is an invalid destination storage account url."
exit 1
fi
shopt -u nocasematch
set -x
platforms=("nodejs" "python" "dotnet" "php" "php-composer" "ruby" "java" "maven" "golang") platforms=("nodejs" "python" "dotnet" "php" "php-composer" "ruby" "java" "maven" "golang")
for platform in "${platforms[@]}" for platform in "${platforms[@]}"

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше