Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/oryx/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/oryx/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "oryx",
"version": "2.0.1",
Comment thread
v-Kaniska244 marked this conversation as resolved.
"version": "2.0.2",
"name": "Oryx",
"description": "Installs the oryx CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",
Expand Down
39 changes: 31 additions & 8 deletions src/oryx/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -208,19 +209,39 @@ 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
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
Expand All @@ -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
Expand All @@ -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!"
15 changes: 9 additions & 6 deletions test/oryx/install_dotnet_and_oryx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
22 changes: 22 additions & 0 deletions test/oryx/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading