From fde3b177b8113dd3aefb107a8b6db2674f6532b2 Mon Sep 17 00:00:00 2001 From: Kaniska Date: Mon, 26 Oct 2026 08:11:49 +0000 Subject: [PATCH 1/3] [oryx] - Optimize feature installation --- src/oryx/NOTES.md | 6 +++++ src/oryx/devcontainer-feature.json | 2 +- src/oryx/install.sh | 39 ++++++++++++++++++++++------ test/oryx/install_dotnet_and_oryx.sh | 15 ++++++----- test/oryx/test.sh | 22 ++++++++++++++++ 5 files changed, 69 insertions(+), 15 deletions(-) diff --git a/src/oryx/NOTES.md b/src/oryx/NOTES.md index ec69ec059..28b609892 100644 --- a/src/oryx/NOTES.md +++ b/src/oryx/NOTES.md @@ -5,3 +5,9 @@ See [supportedPlatformVersions.md](https://github.com/microsoft/Oryx/blob/main/doc/supportedPlatformVersions.md) on the Oryx repository for supported platforms. Notably, `oryx` does not support Debian "jammy". `bash` is required to execute the `install.sh` script. + +## Installation Footprint + +Oryx applications are published self-contained into a shared directory, so they do not require a preinstalled .NET runtime. The build-only SDK and runtimes added by this Feature are removed after publishing; pre-existing .NET installations are preserved. + +Only scripts and metadata used for dynamic SDK installation are retained from the Oryx source tree. Installer logs report disk usage before and after source cleanup. diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index 5e60e3218..6f3d1af4b 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "oryx", - "version": "2.0.1", + "version": "2.0.2", "name": "Oryx", "description": "Installs the oryx CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx", diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 8a85fecd1..998544cdf 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -184,15 +184,16 @@ if [[ "${PINNED_SDK_VERSION}" != "" ]]; then dotnet new globaljson --sdk-version ${PINNED_SDK_VERSION} fi -SOLUTION_FILE_NAME="Oryx.sln" -echo "Building solution '$SOLUTION_FILE_NAME'..." +echo "Publishing Oryx applications..." cd $GIT_ORYX -${DOTNET_BINARY} build "$SOLUTION_FILE_NAME" -c Debug -p:NuGetAudit=false ${DOTNET_BINARY} publish -p:NuGetAudit=false -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj --self-contained true ${DOTNET_BINARY} publish -p:NuGetAudit=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj --self-contained true +find "${BUILD_SCRIPT_GENERATOR}" -maxdepth 1 -type f \ + \( -name '*.pdb' -o -name 'Microsoft.Oryx.*.xml' -o -name 'GenerateBuildScript.xml' \) -delete + chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript ln -s ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript ${ORYX}/oryx @@ -208,6 +209,25 @@ mkdir -p ${PIP_CACHE_DIR} updaterc "export ORYX_SDK_STORAGE_BASE_URL=https://oryx-cdn.microsoft.io && export ENABLE_DYNAMIC_INSTALL=true && DYNAMIC_INSTALL_ROOT_DIR=$ORYX_INSTALL_DIR && ORYX_PREFER_USER_INSTALLED_SDKS=true && export DEBIAN_FLAVOR=bookworm" +cp -a --parents \ + build/__goVersions.sh \ + build/__hugoConstants.sh \ + build/__nodeVersions.sh \ + build/__pythonVersions.sh \ + build/createSymlinksForDotnet.sh \ + images/__common.sh \ + images/__sdkStorageConstants.sh \ + images/constants.yml \ + images/installPlatform.sh \ + images/receiveGpgKeys.sh \ + images/retry.sh \ + images/build/installHugo.sh \ + /opt/tmp +if [[ -d "${GIT_ORYX}/images/build/php/prereqs" ]]; then + cp -a --parents images/build/php/prereqs /opt/tmp +fi +find /opt/tmp/build /opt/tmp/images -type f -name '*.sh' -exec chmod a+x {} + + chown -R "${USERNAME}:oryx" "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" "${PIP_CACHE_DIR}" chmod -R g+r+w "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" "${PIP_CACHE_DIR}" find "${ORYX_INSTALL_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s @@ -215,12 +235,13 @@ find "${BUILD_SCRIPT_GENERATOR}" -type d -print0 | xargs -n 1 -0 chmod g+s find "${ORYX}" -type d -print0 | xargs -n 1 -0 chmod g+s find "${PIP_CACHE_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s -# /opt/tmp/build and /opt/tmp/images is required by Oryx for dynamically installing platforms -cp -rf $GIT_ORYX/build /opt/tmp -cp -rf $GIT_ORYX/images /opt/tmp +echo "Oryx disk usage before cleanup (including temporary source)..." +du -xhd1 "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" /opt/tmp +du -xhd2 /opt/tmp/build /opt/tmp/images # Clean up -rm -rf $GIT_ORYX +cd / +rm -rf "${GIT_ORYX}" # Remove NuGet installed by the build/buildSln.sh rm -rf /root/.nuget @@ -232,7 +253,6 @@ if [[ "${DOTNET_INSTALLATION_PACKAGE}" != "" ]]; then fi if [[ "${PINNED_SDK_VERSION}" != "" ]]; then - rm -f ${GIT_ORYX}/global.json rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION NEW_RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq) if [ -n "${RUNTIME_VERSIONS:-}" ]; then @@ -249,4 +269,7 @@ fi # Clean up rm -rf /var/lib/apt/lists/* +echo "Oryx retained disk usage after cleanup..." +du -xhd1 "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" /opt/tmp + echo "Done!" \ No newline at end of file diff --git a/test/oryx/install_dotnet_and_oryx.sh b/test/oryx/install_dotnet_and_oryx.sh index e17c4e929..daa792da9 100644 --- a/test/oryx/install_dotnet_and_oryx.sh +++ b/test/oryx/install_dotnet_and_oryx.sh @@ -13,17 +13,20 @@ check "Dotnet is not removed if it is not installed by the Oryx Feature" dotnet # Install platforms with oryx build tool check "oryx-install-dotnet-10.0" oryx prep --skip-detection --platforms-and-versions dotnet=10.0.4 -check "dotnet-10-installed-by-oryx" ls /opt/dotnet/ | grep 10.0 +check "dotnet-10-installed-by-oryx" bash -c 'ls /opt/dotnet/ | grep -q "^10[.]0[.]"' check "oryx-install-nodejs-24.13.0" oryx prep --skip-detection --platforms-and-versions nodejs=24.13.0 -check "nodejs-24.13.0-installed-by-oryx" ls /opt/nodejs/ | grep 24.13.0 +check "nodejs-24.13.0-installed-by-oryx" test -d /opt/nodejs/24.13.0 check "oryx-install-php-8.5.1" oryx prep --skip-detection --platforms-and-versions php=8.5.1 -check "php-8.5.1-installed-by-oryx" ls /opt/php/ | grep 8.5.1 +check "php-8.5.1-installed-by-oryx" test -d /opt/php/8.5.1 + +rm -rf /opt/dotnet /opt/nodejs /opt/php /opt/php-composer # Replicates Oryx's behavior for universal image mkdir -p /opt/oryx echo "vso-bookworm" >> /opt/oryx/.imagetype +sudo install -d -o "$(id -u)" -g "$(id -g)" /home/codespace mkdir -p /opt/dotnet/lts cp -R /usr/share/dotnet/dotnet /opt/dotnet/lts @@ -32,13 +35,13 @@ cp -R /usr/share/dotnet/ThirdPartyNotices.txt /opt/dotnet/lts # Install platforms with oryx build tool check "oryx-install-dotnet-10.0" oryx prep --skip-detection --platforms-and-versions dotnet=10.0.4 -check "dotnet-10-installed-by-oryx" ls /opt/dotnet/ | grep 10.0 +check "dotnet-10-installed-by-oryx" bash -c 'ls /opt/dotnet/ | grep -q "^10[.]0[.]"' check "oryx-install-nodejs-24.13.0" oryx prep --skip-detection --platforms-and-versions nodejs=24.13.0 -check "nodejs-24.13.0-installed-by-oryx" ls /opt/nodejs/ | grep 24.13.0 +check "nodejs-24.13.0-installed-by-oryx" test -d /opt/nodejs/24.13.0 check "oryx-install-php-8.5.1" oryx prep --skip-detection --platforms-and-versions php=8.5.1 -check "php-8.5.1-installed-by-oryx" ls /opt/php/ | grep 8.5.1 +check "php-8.5.1-installed-by-oryx" test -d /opt/php/8.5.1 # Report result reportResults diff --git a/test/oryx/test.sh b/test/oryx/test.sh index 1df438e16..4a722700d 100755 --- a/test/oryx/test.sh +++ b/test/oryx/test.sh @@ -9,6 +9,28 @@ check "Oryx version" oryx --version check "ORYX_SDK_STORAGE_BASE_URL" echo $ORYX_SDK_STORAGE_BASE_URL check "ENABLE_DYNAMIC_INSTALL" echo $ENABLE_DYNAMIC_INSTALL +check "dynamic-install-assets" bash -c ' + for asset in \ + build/__goVersions.sh \ + build/__hugoConstants.sh \ + build/__nodeVersions.sh \ + build/__pythonVersions.sh \ + build/createSymlinksForDotnet.sh \ + images/__common.sh \ + images/__sdkStorageConstants.sh \ + images/installPlatform.sh \ + images/receiveGpgKeys.sh \ + images/retry.sh \ + images/build/installHugo.sh; do + test -x "/opt/tmp/${asset}" || exit 1 + done + test -r /opt/tmp/images/constants.yml +' +check "source-repository-removed" test ! -e /opt/tmp/oryx-repo +check "build-tools-not-retained" test ! -e /opt/tmp/build/tools +check "image-definitions-not-retained" test ! -e /opt/tmp/images/build/Dockerfiles +check "publish-debug-artifacts-not-retained" bash -c 'test -z "$(find /usr/local/buildscriptgen -maxdepth 1 -type f \( -name "*.pdb" -o -name "Microsoft.Oryx.*.xml" -o -name "GenerateBuildScript.xml" \) -print -quit)"' + # Install platforms with oryx build tool check "oryx-install-dotnet-8.0" oryx prep --skip-detection --platforms-and-versions dotnet=8.0.23 check "dotnet-2-installed-by-oryx" ls /opt/dotnet/ | grep 8.0 From efd803c4231f9d47b02b9d6876b71181d12ae46d Mon Sep 17 00:00:00 2001 From: Kaniska Date: Mon, 26 Oct 2026 08:38:06 +0000 Subject: [PATCH 2/3] Major version bump --- src/oryx/README.md | 2 +- src/oryx/devcontainer-feature.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oryx/README.md b/src/oryx/README.md index c115e570e..a27704173 100644 --- a/src/oryx/README.md +++ b/src/oryx/README.md @@ -7,7 +7,7 @@ Installs the oryx CLI ```json "features": { - "ghcr.io/devcontainers/features/oryx:2": {} + "ghcr.io/devcontainers/features/oryx:3": {} } ``` diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index 6f3d1af4b..5892df8c0 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "oryx", - "version": "2.0.2", + "version": "3.0.0", "name": "Oryx", "description": "Installs the oryx CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx", From 9ad0b34d7759b4c752430396737bdeb264bb9ff4 Mon Sep 17 00:00:00 2001 From: Kaniska Date: Mon, 26 Oct 2026 12:30:57 +0000 Subject: [PATCH 3/3] Change to patch version bump. --- src/oryx/README.md | 2 +- src/oryx/devcontainer-feature.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oryx/README.md b/src/oryx/README.md index a27704173..c115e570e 100644 --- a/src/oryx/README.md +++ b/src/oryx/README.md @@ -7,7 +7,7 @@ Installs the oryx CLI ```json "features": { - "ghcr.io/devcontainers/features/oryx:3": {} + "ghcr.io/devcontainers/features/oryx:2": {} } ``` diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index 5892df8c0..6f3d1af4b 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "oryx", - "version": "3.0.0", + "version": "2.0.2", "name": "Oryx", "description": "Installs the oryx CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",