Skip to content

Commit

Permalink
Add support for Azurelinux3.0 (#829)
Browse files Browse the repository at this point in the history
* initial commit for azurelinux 3.0 support

* add docker images for azure linux 3.0 and azure linux 3.0 arm64

* fix shortDistroName for azurelinux3-arm64

* update PSVersion

* use aarch rpm package and get latest dotnet version

* add 7-4 images for azurelinux3 and azurelinux3-arm64

* 7-4 images should use stable package url
  • Loading branch information
anamnavi authored Oct 8, 2024
1 parent ed13cb9 commit 00d8b77
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 0 deletions.
90 changes: 90 additions & 0 deletions release/7-4/azurelinux3-arm64/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# 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.aarch64.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 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_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-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 \
dotnet-runtime-8.0 \
ca-certificates

# Install dependencies and clean up
RUN --mount=type=cache,target=/var/cache/tdnf \
tdnf upgrade -y \
# clean cached data
&& tdnf clean all

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/pwsh" ]; then ln -sf /opt/microsoft/powershell/7/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" ]
19 changes: 19 additions & 0 deletions release/7-4/azurelinux3-arm64/meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
91 changes: 91 additions & 0 deletions release/7-4/azurelinux3/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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 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 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.0

# 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 \
dotnet-runtime-8.0 \
ca-certificates

# Install dependencies and clean up
RUN --mount=type=cache,target=/var/cache/tdnf \
tdnf upgrade -y \
# clean cached data
&& tdnf clean all

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/pwsh" ]; then ln -sf /opt/microsoft/powershell/7/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" ]
15 changes: 15 additions & 0 deletions release/7-4/azurelinux3/meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
100 changes: 100 additions & 0 deletions release/7-5/azurelinux3-arm64/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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.5.0-preview.5
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

# 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.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
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" ]
19 changes: 19 additions & 0 deletions release/7-5/azurelinux3-arm64/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"IsLinux" : true,
"UseLinuxVersion": false,
"PackageFormat": "powershell${channelTag}-${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"
}
Loading

0 comments on commit 00d8b77

Please sign in to comment.