Skip to content

Commit ed13cb9

Browse files
authored
Update preview mariner2-arm64 image to use aarch rpm and dotnet 9.0 (#827)
* update preview mariner2-arm64 image to use aarch rpm and dotnet 9.0 * fix typo in PACKAGE_VERSION arg * fix package naming to reflect preview
1 parent 6460bbb commit ed13cb9

File tree

2 files changed

+69
-43
lines changed

2 files changed

+69
-43
lines changed

release/7-5/mariner2-arm64/docker/Dockerfile

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
FROM --platform=linux/arm64 mcr.microsoft.com/cbl-mariner/base/core:2.0 AS installer-env
4+
FROM --platform=linux/arm64 mcr.microsoft.com/cbl-mariner/base/core:2.0 AS setup-tdnf-repa
5+
6+
RUN --mount=type=cache,target=/var/cache/tdnf \
7+
tdnf install -y mariner-repos-microsoft-preview \
8+
&& tdnf makecache
9+
10+
# Download packages into a container so they don't take up space in the final stage
11+
FROM setup-tdnf-repa AS installer-env
512

613
# Define Args for the needed to add the package
7-
ARG PS_VERSION=7.4.0-rc.1
8-
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-arm64.tar.gz
14+
ARG PS_VERSION=7.5.0-preview.4
15+
ARG PACKAGE_VERSION=7.5.0_preview.4
16+
ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.aarch64.rpm
917
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
1018
ARG PS_INSTALL_VERSION=7-preview
1119

12-
# Define the folder we will be installing PowerShell to.
13-
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/${PS_INSTALL_VERSION}
14-
15-
# Create the install folder.
16-
RUN mkdir -p ${PS_INSTALL_FOLDER}
20+
# Download the Linux tar.gz and save it
21+
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
1722

18-
ARG PS_PACKAGE_URL_BASE64
23+
# 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
24+
RUN tdnf install -y \
25+
wget \
26+
awk \
27+
tar \
28+
ca-certificates
1929

2030
RUN --mount=type=cache,target=/var/cache/tdnf \
21-
tdnf update -y \
22-
&& tdnf install -y ca-certificates wget tar
31+
--mount=type=cache,target=/installTmp \
32+
cd /installTmp \
33+
&& wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
34+
&& chmod +x ./dotnet-install.sh \
35+
&& ./dotnet-install.sh -Channel 9.0 -Quality ga -Runtime dotnet -InstallDir /usr/share/dotnet
2336

24-
RUN echo 'in task' \
25-
&& if [ -n "${PS_PACKAGE_URL_BASE64}" ]; then \
26-
echo 'using base64' \
27-
&& export url=$(echo "${PS_PACKAGE_URL_BASE64}" | base64 --decode -); \
28-
else \
29-
echo 'using unencoded' \
30-
&& export url="${PS_PACKAGE_URL}"; \
31-
fi \
32-
&& echo "url: $url" \
33-
&& wget -O /tmp/powershell.tar.gz "$url" \
34-
&& echo 'task done'
37+
RUN echo ${PS_PACKAGE_URL}
3538

36-
RUN ls -l /tmp/powershell.tar.gz
39+
# Start a new stage so we lose all the package download layers from the final image
40+
FROM setup-tdnf-repa AS powershell
3741

38-
# Unzip the linux powershell.tar.gz
39-
RUN tar zxf /tmp/powershell.tar.gz -C ${PS_INSTALL_FOLDER}
40-
41-
FROM --platform=linux/arm64 mcr.microsoft.com/cbl-mariner/base/core:2.0 AS final-image
42-
43-
# Define Args and Env needed to create links
42+
ARG PS_VERSION=7.5.0-preview.4
4443
ARG PS_INSTALL_VERSION=7-preview
45-
ARG PS_VERSION=7.4.0-rc.1
4644

45+
# Define Args and Env needed to create links
4746
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
4847
\
4948
# Define ENVs for Localization/Globalization
@@ -54,20 +53,47 @@ FROM --platform=linux/arm64 mcr.microsoft.com/cbl-mariner/base/core:2.0 AS final
5453
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
5554
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-Mariner-2
5655

57-
# Copy only the files we need from the previous stage
58-
COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"]
59-
60-
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
61-
tdnf update -y \
62-
&& tdnf install -y icu less openssh-clients ca-certificates dotnet-runtime-7.0 \
63-
&& tdnf upgrade -y \
56+
RUN --mount=type=cache,target=/var/cache/tdnf \
57+
# install dependencies
58+
tdnf install -y \
59+
# required for localization
60+
icu \
61+
# required for help in PowerShell
62+
less \
63+
# required for SSH
64+
openssh-clients \
65+
ca-certificates
66+
67+
# Install dependencies and clean up
68+
RUN --mount=type=cache,target=/var/cache/tdnf \
69+
tdnf upgrade -y \
70+
# clean cached data
6471
&& tdnf clean all
6572

66-
# Give all user execute permissions and remove write permissions for others
67-
RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
68-
# Create the pwsh symbolic link that points to powershell
69-
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
70-
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview
73+
COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet
74+
75+
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
76+
77+
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
78+
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
79+
rpm -i --nodeps /mnt/rpm/powershell.rpm
80+
81+
# Create the pwsh symbolic link that points to powershell
82+
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi
83+
84+
# intialize powershell module cache
85+
# and disable telemetry for this ONE session
86+
RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \
87+
&& pwsh \
88+
-NoLogo \
89+
-NoProfile \
90+
-Command " \
91+
\$ErrorActionPreference = 'Stop' ; \
92+
\$ProgressPreference = 'SilentlyContinue' ; \
93+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
94+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
95+
Start-Sleep -Seconds 6 ; \
96+
}"
7197

7298
# Use PowerShell as the default shell
7399
# Use array to avoid Docker prepending /bin/sh -c

release/7-5/mariner2-arm64/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"IsLinux" : true,
33
"UseLinuxVersion": false,
4-
"PackageFormat": "powershell-${PS_VERSION}-linux-arm64.tar.gz",
4+
"PackageFormat": "powershell${channelTag}-${PS_VERSION}-1.cm.aarch64.rpm",
55
"osVersion": "Mariner 2.0 ARM 64v7",
66
"SkipGssNtlmSspTests": true,
77
"ShortDistroName": "mariner",

0 commit comments

Comments
 (0)