From b495f939790f9f62a27ff5bc070f8e1ffb9f2c2c Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 20 Aug 2024 23:26:49 -0400 Subject: [PATCH 1/7] initial commit for azurelinux 3.0 support --- release/7-5/azurelinux3/docker/Dockerfile | 102 ++++++++++++++++++++++ release/7-5/azurelinux3/meta.json | 15 ++++ 2 files changed, 117 insertions(+) create mode 100644 release/7-5/azurelinux3/docker/Dockerfile create mode 100644 release/7-5/azurelinux3/meta.json diff --git a/release/7-5/azurelinux3/docker/Dockerfile b/release/7-5/azurelinux3/docker/Dockerfile new file mode 100644 index 000000000..da1958dc8 --- /dev/null +++ b/release/7-5/azurelinux3/docker/Dockerfile @@ -0,0 +1,102 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa + + # Use the cache mount since this image does go into the final product + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf install -y mariner-repos-microsoft-preview \ + && tdnf makecache + +# Download packages into a container so they don't take up space in the final stage +FROM setup-tdnf-repa AS installer-env + + # Define Args for the needed to add the package + ARG PS_VERSION=7.5.0-preview.2 + ARG PACKAGE_VERSION=7.5.0_preview.2 + ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.x86_64.rpm + ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + ARG PS_INSTALL_VERSION=7-preview + + # Download the Linux tar.gz and save it + ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm + + # Don't use the cache mount since this image doesn't go into the final product and it causes issues with parralel operations with the next layer + RUN tdnf install -y \ + wget \ + awk \ + tar \ + ca-certificates + + RUN --mount=type=cache,target=/var/cache/tdnf \ + --mount=type=cache,target=/installTmp \ + cd /installTmp \ + && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ + && chmod +x ./dotnet-install.sh \ + && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet + + RUN echo ${PS_PACKAGE_URL} + +# Start a new stage so we lose all the package download layers from the final image +FROM setup-tdnf-repa AS powershell + + ARG PS_VERSION=7.5.0-preview.2 + ARG PS_INSTALL_VERSION=7-preview + + # Define Args and Env needed to create links + ARG PS_INSTALL_VERSION=7-preview + ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ + \ + # Define ENVs for Localization/Globalization + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + # set a fixed location for the Module analysis cache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-AzureLinux-3.0 + + RUN --mount=type=cache,target=/var/cache/tdnf \ + # install dependencies + tdnf install -y \ + # required for localization + icu \ + # required for help in PowerShell + less \ + # required for SSH + openssh-clients \ + ca-certificates + + # Install dependencies and clean up + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf upgrade -y \ + # clean cached data + && tdnf clean all + + COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet + + RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + + RUN --mount=type=cache,target=/var/cache/tdnf,rw \ + --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ + rpm -i --nodeps /mnt/rpm/powershell.rpm + + # Create the pwsh symbolic link that points to powershell + RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + + # intialize powershell module cache + # and disable telemetry for this ONE session + RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \ + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + \$ErrorActionPreference = 'Stop' ; \ + \$ProgressPreference = 'SilentlyContinue' ; \ + while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ + Start-Sleep -Seconds 6 ; \ + }" + + # Use PowerShell as the default shell + # Use array to avoid Docker prepending /bin/sh -c + CMD [ "pwsh" ] diff --git a/release/7-5/azurelinux3/meta.json b/release/7-5/azurelinux3/meta.json new file mode 100644 index 000000000..a47740aa7 --- /dev/null +++ b/release/7-5/azurelinux3/meta.json @@ -0,0 +1,15 @@ +{ + "IsLinux" : true, + "PackageFormat": "powershell${channelTag}-${PS_VERSION}-1.cm.x86_64.rpm", + "SkipGssNtlmSspTests": true, + "osVersion": "AzureLinux 3.0", + "shortTags": [ + {"Tag": "3.0"} + ], + "ShortDistroName": "azurelinux", + "TestProperties": { + "size": 335 + }, + "EndOfLife": "2026-01-14", + "DistributionState": "Validating" +} From a259f346db877ddddfa3e619c4b3e4bc9ce6b0f9 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 10 Sep 2024 15:31:25 -0400 Subject: [PATCH 2/7] add docker images for azure linux 3.0 and azure linux 3.0 arm64 --- .../7-5/azurelinux3-arm64/docker/Dockerfile | 74 +++++++++++++++++++ release/7-5/azurelinux3-arm64/meta.json | 19 +++++ release/7-5/azurelinux3/docker/Dockerfile | 3 +- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 release/7-5/azurelinux3-arm64/docker/Dockerfile create mode 100644 release/7-5/azurelinux3-arm64/meta.json diff --git a/release/7-5/azurelinux3-arm64/docker/Dockerfile b/release/7-5/azurelinux3-arm64/docker/Dockerfile new file mode 100644 index 000000000..9fd39bcd6 --- /dev/null +++ b/release/7-5/azurelinux3-arm64/docker/Dockerfile @@ -0,0 +1,74 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS installer-env + + # Define Args for the needed to add the package + ARG PS_VERSION=7.4.0-rc.1 + ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-arm64.tar.gz + ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + ARG PS_INSTALL_VERSION=7-preview + + # Define the folder we will be installing PowerShell to. + ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/${PS_INSTALL_VERSION} + + # Create the install folder. + RUN mkdir -p ${PS_INSTALL_FOLDER} + + ARG PS_PACKAGE_URL_BASE64 + + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf update -y \ + && tdnf install -y ca-certificates wget tar + + RUN echo 'in task' \ + && if [ -n "${PS_PACKAGE_URL_BASE64}" ]; then \ + echo 'using base64' \ + && export url=$(echo "${PS_PACKAGE_URL_BASE64}" | base64 --decode -); \ + else \ + echo 'using unencoded' \ + && export url="${PS_PACKAGE_URL}"; \ + fi \ + && echo "url: $url" \ + && wget -O /tmp/powershell.tar.gz "$url" \ + && echo 'task done' + + RUN ls -l /tmp/powershell.tar.gz + + # Unzip the linux powershell.tar.gz + RUN tar zxf /tmp/powershell.tar.gz -C ${PS_INSTALL_FOLDER} + +FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS final-image + + # Define Args and Env needed to create links + ARG PS_INSTALL_VERSION=7-preview + ARG PS_VERSION=7.4.0-rc.1 + + ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ + \ + # Define ENVs for Localization/Globalization + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + # set a fixed location for the Module analysis cache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-AzureLinux-3 + + # Copy only the files we need from the previous stage + COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] + + RUN --mount=type=cache,target=/var/cache/tdnf,rw \ + tdnf update -y \ + && tdnf install -y icu less openssh-clients ca-certificates dotnet-runtime-8.0 \ + && tdnf upgrade -y \ + && tdnf clean all + + # Give all user execute permissions and remove write permissions for others + RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ + # Create the pwsh symbolic link that points to powershell + && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \ + && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview + + # Use PowerShell as the default shell + # Use array to avoid Docker prepending /bin/sh -c + CMD [ "pwsh" ] diff --git a/release/7-5/azurelinux3-arm64/meta.json b/release/7-5/azurelinux3-arm64/meta.json new file mode 100644 index 000000000..7bf359a55 --- /dev/null +++ b/release/7-5/azurelinux3-arm64/meta.json @@ -0,0 +1,19 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-${PS_VERSION}-linux-arm64.tar.gz", + "osVersion": "Azure Linux 3.0 ARM 64v7", + "SkipGssNtlmSspTests": true, + "ShortDistroName": "mariner", + "shortTags": [ + {"Tag": "3.0-arm64"} + ], + "TestProperties": { + "size": 404, + "Arm32": true + }, + "EndOfLife": "2025-12-14", + "DistributionState": "Validated", + "UseInCi": false, + "Architecture": "arm64" +} diff --git a/release/7-5/azurelinux3/docker/Dockerfile b/release/7-5/azurelinux3/docker/Dockerfile index da1958dc8..cd1c723b6 100644 --- a/release/7-5/azurelinux3/docker/Dockerfile +++ b/release/7-5/azurelinux3/docker/Dockerfile @@ -4,8 +4,9 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa # Use the cache mount since this image does go into the final product + # TODO: OR azurelinux-repos-preview RUN --mount=type=cache,target=/var/cache/tdnf \ - tdnf install -y mariner-repos-microsoft-preview \ + tdnf install -y azurelinux-repos \ && tdnf makecache # Download packages into a container so they don't take up space in the final stage From 583519e6115d42da6feae4c4aafe4b4cc5197984 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 10 Sep 2024 15:33:57 -0400 Subject: [PATCH 3/7] fix shortDistroName for azurelinux3-arm64 --- release/7-5/azurelinux3-arm64/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/7-5/azurelinux3-arm64/meta.json b/release/7-5/azurelinux3-arm64/meta.json index 7bf359a55..5d7029159 100644 --- a/release/7-5/azurelinux3-arm64/meta.json +++ b/release/7-5/azurelinux3-arm64/meta.json @@ -4,7 +4,7 @@ "PackageFormat": "powershell-${PS_VERSION}-linux-arm64.tar.gz", "osVersion": "Azure Linux 3.0 ARM 64v7", "SkipGssNtlmSspTests": true, - "ShortDistroName": "mariner", + "ShortDistroName": "azurelinux", "shortTags": [ {"Tag": "3.0-arm64"} ], From dd1799a42985e6061f7f95bc25009a11bed498a6 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 7 Oct 2024 12:39:58 -0400 Subject: [PATCH 4/7] update PSVersion --- release/7-5/azurelinux3-arm64/docker/Dockerfile | 4 ++-- release/7-5/azurelinux3/docker/Dockerfile | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/release/7-5/azurelinux3-arm64/docker/Dockerfile b/release/7-5/azurelinux3-arm64/docker/Dockerfile index 9fd39bcd6..6c0e7555c 100644 --- a/release/7-5/azurelinux3-arm64/docker/Dockerfile +++ b/release/7-5/azurelinux3-arm64/docker/Dockerfile @@ -4,7 +4,7 @@ FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS installer-env # Define Args for the needed to add the package - ARG PS_VERSION=7.4.0-rc.1 + ARG PS_VERSION=7.5.0-preview.5 ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-arm64.tar.gz ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} ARG PS_INSTALL_VERSION=7-preview @@ -42,7 +42,7 @@ FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS final- # Define Args and Env needed to create links ARG PS_INSTALL_VERSION=7-preview - ARG PS_VERSION=7.4.0-rc.1 + ARG PS_VERSION=7.5.0-preview.5 ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ \ diff --git a/release/7-5/azurelinux3/docker/Dockerfile b/release/7-5/azurelinux3/docker/Dockerfile index cd1c723b6..72303f633 100644 --- a/release/7-5/azurelinux3/docker/Dockerfile +++ b/release/7-5/azurelinux3/docker/Dockerfile @@ -13,8 +13,8 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa FROM setup-tdnf-repa AS installer-env # Define Args for the needed to add the package - ARG PS_VERSION=7.5.0-preview.2 - ARG PACKAGE_VERSION=7.5.0_preview.2 + ARG PS_VERSION=7.5.0-preview.5 + ARG PACKAGE_VERSION=7.5.0_preview.5 ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.x86_64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} ARG PS_INSTALL_VERSION=7-preview @@ -41,7 +41,7 @@ FROM setup-tdnf-repa AS installer-env # Start a new stage so we lose all the package download layers from the final image FROM setup-tdnf-repa AS powershell - ARG PS_VERSION=7.5.0-preview.2 + ARG PS_VERSION=7.5.0-preview.5 ARG PS_INSTALL_VERSION=7-preview # Define Args and Env needed to create links From 9043a38d55184f4055a915d2f59c59b6505f8083 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 7 Oct 2024 17:51:15 -0400 Subject: [PATCH 5/7] use aarch rpm package and get latest dotnet version --- .../7-5/azurelinux3-arm64/docker/Dockerfile | 108 +++++++++++------- release/7-5/azurelinux3-arm64/meta.json | 2 +- 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/release/7-5/azurelinux3-arm64/docker/Dockerfile b/release/7-5/azurelinux3-arm64/docker/Dockerfile index 6c0e7555c..140174999 100644 --- a/release/7-5/azurelinux3-arm64/docker/Dockerfile +++ b/release/7-5/azurelinux3-arm64/docker/Dockerfile @@ -1,49 +1,48 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS installer-env +FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa + + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf install -y azurelinux-repos \ + && tdnf makecache + +# Download packages into a container so they don't take up space in the final stage +FROM setup-tdnf-repa AS installer-env # Define Args for the needed to add the package ARG PS_VERSION=7.5.0-preview.5 - ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-arm64.tar.gz + ARG PACKAGE_VERSION=7.5.0_preview.5 + ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.aarch64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} ARG PS_INSTALL_VERSION=7-preview - # Define the folder we will be installing PowerShell to. - ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/${PS_INSTALL_VERSION} + # Download the Linux tar.gz and save it + ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm - # Create the install folder. - RUN mkdir -p ${PS_INSTALL_FOLDER} - - ARG PS_PACKAGE_URL_BASE64 + # Don't use the cache mount since this image doesn't go into the final product and it causes issues with parralel operations with the next layer + RUN tdnf install -y \ + wget \ + awk \ + tar \ + ca-certificates RUN --mount=type=cache,target=/var/cache/tdnf \ - tdnf update -y \ - && tdnf install -y ca-certificates wget tar - - RUN echo 'in task' \ - && if [ -n "${PS_PACKAGE_URL_BASE64}" ]; then \ - echo 'using base64' \ - && export url=$(echo "${PS_PACKAGE_URL_BASE64}" | base64 --decode -); \ - else \ - echo 'using unencoded' \ - && export url="${PS_PACKAGE_URL}"; \ - fi \ - && echo "url: $url" \ - && wget -O /tmp/powershell.tar.gz "$url" \ - && echo 'task done' + --mount=type=cache,target=/installTmp \ + cd /installTmp \ + && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ + && chmod +x ./dotnet-install.sh \ + && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet - RUN ls -l /tmp/powershell.tar.gz + RUN echo ${PS_PACKAGE_URL} - # Unzip the linux powershell.tar.gz - RUN tar zxf /tmp/powershell.tar.gz -C ${PS_INSTALL_FOLDER} +# Start a new stage so we lose all the package download layers from the final image +FROM setup-tdnf-repa AS powershell -FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS final-image - - # Define Args and Env needed to create links - ARG PS_INSTALL_VERSION=7-preview ARG PS_VERSION=7.5.0-preview.5 + ARG PS_INSTALL_VERSION=7-preview + # Define Args and Env needed to create links ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ \ # Define ENVs for Localization/Globalization @@ -54,20 +53,47 @@ FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS final- PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-AzureLinux-3 - # Copy only the files we need from the previous stage - COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] - - RUN --mount=type=cache,target=/var/cache/tdnf,rw \ - tdnf update -y \ - && tdnf install -y icu less openssh-clients ca-certificates dotnet-runtime-8.0 \ - && tdnf upgrade -y \ + RUN --mount=type=cache,target=/var/cache/tdnf \ + # install dependencies + tdnf install -y \ + # required for localization + icu \ + # required for help in PowerShell + less \ + # required for SSH + openssh-clients \ + ca-certificates + + # Install dependencies and clean up + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf upgrade -y \ + # clean cached data && tdnf clean all - # Give all user execute permissions and remove write permissions for others - RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ - # Create the pwsh symbolic link that points to powershell - && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \ - && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview + COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet + + RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + + RUN --mount=type=cache,target=/var/cache/tdnf,rw \ + --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ + rpm -i --nodeps /mnt/rpm/powershell.rpm + + # Create the pwsh symbolic link that points to powershell + RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + + # intialize powershell module cache + # and disable telemetry for this ONE session + RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \ + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + \$ErrorActionPreference = 'Stop' ; \ + \$ProgressPreference = 'SilentlyContinue' ; \ + while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ + Start-Sleep -Seconds 6 ; \ + }" # Use PowerShell as the default shell # Use array to avoid Docker prepending /bin/sh -c diff --git a/release/7-5/azurelinux3-arm64/meta.json b/release/7-5/azurelinux3-arm64/meta.json index 5d7029159..a71096ca2 100644 --- a/release/7-5/azurelinux3-arm64/meta.json +++ b/release/7-5/azurelinux3-arm64/meta.json @@ -1,7 +1,7 @@ { "IsLinux" : true, "UseLinuxVersion": false, - "PackageFormat": "powershell-${PS_VERSION}-linux-arm64.tar.gz", + "PackageFormat": "powershell${channelTag}-${PS_VERSION}-1.cm.aarch64.rpm", "osVersion": "Azure Linux 3.0 ARM 64v7", "SkipGssNtlmSspTests": true, "ShortDistroName": "azurelinux", From c1159865f2cd82287991cf1c8b10b2ff9fe8a84c Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 8 Oct 2024 11:10:43 -0400 Subject: [PATCH 6/7] add 7-4 images for azurelinux3 and azurelinux3-arm64 --- .../7-4/azurelinux3-arm64/docker/Dockerfile | 102 ++++++++++++++++++ release/7-4/azurelinux3-arm64/meta.json | 19 ++++ release/7-4/azurelinux3/docker/Dockerfile | 101 +++++++++++++++++ release/7-4/azurelinux3/meta.json | 15 +++ release/7-5/azurelinux3/docker/Dockerfile | 2 - 5 files changed, 237 insertions(+), 2 deletions(-) create mode 100644 release/7-4/azurelinux3-arm64/docker/Dockerfile create mode 100644 release/7-4/azurelinux3-arm64/meta.json create mode 100644 release/7-4/azurelinux3/docker/Dockerfile create mode 100644 release/7-4/azurelinux3/meta.json diff --git a/release/7-4/azurelinux3-arm64/docker/Dockerfile b/release/7-4/azurelinux3-arm64/docker/Dockerfile new file mode 100644 index 000000000..662e402e6 --- /dev/null +++ b/release/7-4/azurelinux3-arm64/docker/Dockerfile @@ -0,0 +1,102 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +FROM --platform=linux/arm64 mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa + + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf install -y azurelinux-repos \ + && tdnf makecache + +# Download packages into a container so they don't take up space in the final stage +FROM setup-tdnf-repa AS installer-env + + # Define Args for the needed to add the package + ARG PS_VERSION=7.4.5 + ARG PACKAGE_VERSION=7.4.5 + ARG PS_PACKAGE=powershell-${PACKAGE_VERSION}-1.cm.x86_64.rpm + ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + ARG PS_INSTALL_VERSION=7 + + # Download the Linux tar.gz and save it + ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm + + # Don't use the cache mount since this image doesn't go into the final product and it causes issues with parralel operations with the next layer + RUN tdnf install -y \ + wget \ + awk \ + tar \ + ca-certificates + + RUN --mount=type=cache,target=/var/cache/tdnf \ + --mount=type=cache,target=/installTmp \ + cd /installTmp \ + && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ + && chmod +x ./dotnet-install.sh \ + && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet + + RUN echo ${PS_PACKAGE_URL} + +# Start a new stage so we lose all the package download layers from the final image +FROM setup-tdnf-repa AS powershell + + ARG PS_VERSION=7.4.5 + + # Define Args and Env needed to create links + ARG PS_INSTALL_VERSION=7 + + # Define Args and Env needed to create links + ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ + \ + # Define ENVs for Localization/Globalization + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + # set a fixed location for the Module analysis cache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-AzureLinux-3 + + RUN --mount=type=cache,target=/var/cache/tdnf \ + # install dependencies + tdnf install -y \ + # required for localization + icu \ + # required for help in PowerShell + less \ + # required for SSH + openssh-clients \ + ca-certificates + + # Install dependencies and clean up + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf upgrade -y \ + # clean cached data + && tdnf clean all + + COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet + + RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + + RUN --mount=type=cache,target=/var/cache/tdnf,rw \ + --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ + rpm -i --nodeps /mnt/rpm/powershell.rpm + + # Create the pwsh symbolic link that points to powershell + RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + + # intialize powershell module cache + # and disable telemetry for this ONE session + RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \ + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + \$ErrorActionPreference = 'Stop' ; \ + \$ProgressPreference = 'SilentlyContinue' ; \ + while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ + Start-Sleep -Seconds 6 ; \ + }" + + # Use PowerShell as the default shell + # Use array to avoid Docker prepending /bin/sh -c + CMD [ "pwsh" ] diff --git a/release/7-4/azurelinux3-arm64/meta.json b/release/7-4/azurelinux3-arm64/meta.json new file mode 100644 index 000000000..38bb0eed0 --- /dev/null +++ b/release/7-4/azurelinux3-arm64/meta.json @@ -0,0 +1,19 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-${PS_VERSION}-1.cm.aarch64.rpm", + "osVersion": "Azure Linux 3.0 ARM 64v7", + "SkipGssNtlmSspTests": true, + "ShortDistroName": "azurelinux", + "shortTags": [ + {"Tag": "3.0-arm64"} + ], + "TestProperties": { + "size": 404, + "Arm32": true + }, + "EndOfLife": "2025-12-14", + "DistributionState": "Validated", + "UseInCi": false, + "Architecture": "arm64" +} diff --git a/release/7-4/azurelinux3/docker/Dockerfile b/release/7-4/azurelinux3/docker/Dockerfile new file mode 100644 index 000000000..8f2a247e7 --- /dev/null +++ b/release/7-4/azurelinux3/docker/Dockerfile @@ -0,0 +1,101 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa + + # Use the cache mount since this image does go into the final products + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf install -y azurelinux-repos \ + && tdnf makecache + +# Download packages into a container so they don't take up space in the final stage +FROM setup-tdnf-repa AS installer-env + + # Define Args for the needed to add the package + ARG PS_VERSION=7.4.5 + ARG PACKAGE_VERSION=7.4.5 + ARG PS_PACKAGE=powershell-${PACKAGE_VERSION}-1.cm.x86_64.rpm + ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + ARG PS_INSTALL_VERSION=7 + + # Download the Linux tar.gz and save it + ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm + + # Don't use the cache mount since this image doesn't go into the final product and it causes issues with parralel operations with the next layer + RUN tdnf install -y \ + wget \ + awk \ + tar \ + ca-certificates + + RUN --mount=type=cache,target=/var/cache/tdnf \ + --mount=type=cache,target=/installTmp \ + cd /installTmp \ + && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ + && chmod +x ./dotnet-install.sh \ + && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet + + RUN echo ${PS_PACKAGE_URL} + +# Start a new stage so we lose all the package download layers from the final image +FROM setup-tdnf-repa AS powershell + + ARG PS_VERSION=7.4.5 + + # Define Args and Env needed to create links + ARG PS_INSTALL_VERSION=7 + ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ + \ + # Define ENVs for Localization/Globalization + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + # set a fixed location for the Module analysis cache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-AzureLinux-3.0 + + RUN --mount=type=cache,target=/var/cache/tdnf \ + # install dependencies + tdnf install -y \ + # required for localization + icu \ + # required for help in PowerShell + less \ + # required for SSH + openssh-clients \ + ca-certificates + + # Install dependencies and clean up + RUN --mount=type=cache,target=/var/cache/tdnf \ + tdnf upgrade -y \ + # clean cached data + && tdnf clean all + + COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet + + RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + + RUN --mount=type=cache,target=/var/cache/tdnf,rw \ + --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ + rpm -i --nodeps /mnt/rpm/powershell.rpm + + # Create the pwsh symbolic link that points to powershell + RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + + # intialize powershell module cache + # and disable telemetry for this ONE session + RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \ + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + \$ErrorActionPreference = 'Stop' ; \ + \$ProgressPreference = 'SilentlyContinue' ; \ + while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ + Start-Sleep -Seconds 6 ; \ + }" + + # Use PowerShell as the default shell + # Use array to avoid Docker prepending /bin/sh -c + CMD [ "pwsh" ] diff --git a/release/7-4/azurelinux3/meta.json b/release/7-4/azurelinux3/meta.json new file mode 100644 index 000000000..0944fe03d --- /dev/null +++ b/release/7-4/azurelinux3/meta.json @@ -0,0 +1,15 @@ +{ + "IsLinux" : true, + "PackageFormat": "powershell${channelTag}-${PS_VERSION}-1.cm.x86_64.rpm", + "SkipGssNtlmSspTests": true, + "osVersion": "Azure Linux 3.0", + "shortTags": [ + {"Tag": "3.0"} + ], + "ShortDistroName": "azurelinux", + "TestProperties": { + "size": 335 + }, + "EndOfLife": "2025-10-14", + "DistributionState": "Validated" +} diff --git a/release/7-5/azurelinux3/docker/Dockerfile b/release/7-5/azurelinux3/docker/Dockerfile index 72303f633..2eae2ee31 100644 --- a/release/7-5/azurelinux3/docker/Dockerfile +++ b/release/7-5/azurelinux3/docker/Dockerfile @@ -4,7 +4,6 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa # Use the cache mount since this image does go into the final product - # TODO: OR azurelinux-repos-preview RUN --mount=type=cache,target=/var/cache/tdnf \ tdnf install -y azurelinux-repos \ && tdnf makecache @@ -42,7 +41,6 @@ FROM setup-tdnf-repa AS installer-env FROM setup-tdnf-repa AS powershell ARG PS_VERSION=7.5.0-preview.5 - ARG PS_INSTALL_VERSION=7-preview # Define Args and Env needed to create links ARG PS_INSTALL_VERSION=7-preview From ef1925f529116c25045efcaa9bbcd3d54ffffc8f Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 8 Oct 2024 12:07:55 -0400 Subject: [PATCH 7/7] 7-4 images should use stable package url --- .../7-4/azurelinux3-arm64/docker/Dockerfile | 20 +++----------- release/7-4/azurelinux3/docker/Dockerfile | 26 ++++++------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/release/7-4/azurelinux3-arm64/docker/Dockerfile b/release/7-4/azurelinux3-arm64/docker/Dockerfile index 662e402e6..82a4633ed 100644 --- a/release/7-4/azurelinux3-arm64/docker/Dockerfile +++ b/release/7-4/azurelinux3-arm64/docker/Dockerfile @@ -13,7 +13,7 @@ FROM setup-tdnf-repa AS installer-env # Define Args for the needed to add the package ARG PS_VERSION=7.4.5 ARG PACKAGE_VERSION=7.4.5 - ARG PS_PACKAGE=powershell-${PACKAGE_VERSION}-1.cm.x86_64.rpm + ARG PS_PACKAGE=powershell-${PACKAGE_VERSION}-1.cm.aarch64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} ARG PS_INSTALL_VERSION=7 @@ -27,21 +27,12 @@ FROM setup-tdnf-repa AS installer-env tar \ ca-certificates - RUN --mount=type=cache,target=/var/cache/tdnf \ - --mount=type=cache,target=/installTmp \ - cd /installTmp \ - && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ - && chmod +x ./dotnet-install.sh \ - && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet - RUN echo ${PS_PACKAGE_URL} # Start a new stage so we lose all the package download layers from the final image FROM setup-tdnf-repa AS powershell ARG PS_VERSION=7.4.5 - - # Define Args and Env needed to create links ARG PS_INSTALL_VERSION=7 # Define Args and Env needed to create links @@ -53,7 +44,7 @@ FROM setup-tdnf-repa AS powershell LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ - POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-AzureLinux-3 + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-AzureLinux-3.0 RUN --mount=type=cache,target=/var/cache/tdnf \ # install dependencies @@ -64,6 +55,7 @@ FROM setup-tdnf-repa AS powershell less \ # required for SSH openssh-clients \ + dotnet-runtime-8.0 \ ca-certificates # Install dependencies and clean up @@ -72,16 +64,12 @@ FROM setup-tdnf-repa AS powershell # clean cached data && tdnf clean all - COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet - - RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet - RUN --mount=type=cache,target=/var/cache/tdnf,rw \ --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ rpm -i --nodeps /mnt/rpm/powershell.rpm # Create the pwsh symbolic link that points to powershell - RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + RUN if [ -f "/opt/microsoft/powershell/7/pwsh" ]; then ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh; fi # intialize powershell module cache # and disable telemetry for this ONE session diff --git a/release/7-4/azurelinux3/docker/Dockerfile b/release/7-4/azurelinux3/docker/Dockerfile index 8f2a247e7..9304c3777 100644 --- a/release/7-4/azurelinux3/docker/Dockerfile +++ b/release/7-4/azurelinux3/docker/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0 AS setup-tdnf-repa - # Use the cache mount since this image does go into the final products + # Use the cache mount since this image does go into the final product RUN --mount=type=cache,target=/var/cache/tdnf \ tdnf install -y azurelinux-repos \ && tdnf makecache @@ -23,24 +23,17 @@ FROM setup-tdnf-repa AS installer-env # Don't use the cache mount since this image doesn't go into the final product and it causes issues with parralel operations with the next layer RUN tdnf install -y \ - wget \ - awk \ - tar \ - ca-certificates - - RUN --mount=type=cache,target=/var/cache/tdnf \ - --mount=type=cache,target=/installTmp \ - cd /installTmp \ - && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ - && chmod +x ./dotnet-install.sh \ - && ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet + wget \ + awk \ + tar \ + ca-certificates RUN echo ${PS_PACKAGE_URL} # Start a new stage so we lose all the package download layers from the final image FROM setup-tdnf-repa AS powershell - ARG PS_VERSION=7.4.5 + ARG PS_VERSION=7.4.0 # Define Args and Env needed to create links ARG PS_INSTALL_VERSION=7 @@ -63,6 +56,7 @@ FROM setup-tdnf-repa AS powershell less \ # required for SSH openssh-clients \ + dotnet-runtime-8.0 \ ca-certificates # Install dependencies and clean up @@ -71,16 +65,12 @@ FROM setup-tdnf-repa AS powershell # clean cached data && tdnf clean all - COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet - - RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet - RUN --mount=type=cache,target=/var/cache/tdnf,rw \ --mount=from=installer-env,target=/mnt/rpm,source=/tmp \ rpm -i --nodeps /mnt/rpm/powershell.rpm # Create the pwsh symbolic link that points to powershell - RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi + RUN if [ -f "/opt/microsoft/powershell/7/pwsh" ]; then ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh; fi # intialize powershell module cache # and disable telemetry for this ONE session