Skip to content

Commit 23d81a2

Browse files
authored
Update 7.4 Mariner images to use dotnet from PMC (#781)
* Create 7.5 channel for previews * Update mariner 7-4 packages to use dotnet from PMC * update the json to match the package
1 parent bd5fde8 commit 23d81a2

File tree

50 files changed

+1988
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1988
-160
lines changed
Lines changed: 86 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,90 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0.20221222-arm64 AS installer-env
5-
6-
# Define Args for the needed to add the package
7-
ARG PS_VERSION=7.4.0-preview.1
8-
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-arm64.tar.gz
9-
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
10-
ARG PS_INSTALL_VERSION=7-preview
11-
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}
17-
18-
ARG PS_PACKAGE_URL_BASE64
19-
20-
RUN --mount=type=cache,target=/var/cache/tdnf \
21-
tdnf update -y \
22-
&& tdnf install -y ca-certificates wget tar
23-
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'
35-
36-
RUN ls -l /tmp/powershell.tar.gz
37-
38-
# Unzip the linux powershell.tar.gz
39-
RUN tar zxf /tmp/powershell.tar.gz -C ${PS_INSTALL_FOLDER}
40-
41-
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0.20221222-arm64 AS final-image
42-
43-
# Define Args and Env needed to create links
44-
ARG PS_INSTALL_VERSION=7-preview
45-
ARG PS_VERSION=7.4.0-preview.1
46-
47-
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
48-
\
49-
# Define ENVs for Localization/Globalization
50-
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
51-
LC_ALL=en_US.UTF-8 \
52-
LANG=en_US.UTF-8 \
53-
# set a fixed location for the Module analysis cache
54-
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
55-
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-arm64v7-Mariner-2
56-
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 \
64-
&& tdnf clean all
65-
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
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
12+
13+
# Define Args for the needed to add the package
14+
ARG PS_VERSION=7.4.0
15+
ARG PACKAGE_VERSION=7.4.0
16+
ARG PS_PACKAGE=powershell-${PACKAGE_VERSION}-1.cm.aarch64.rpm
17+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
18+
ARG PS_INSTALL_VERSION=7
19+
20+
# Download the Linux tar.gz and save it
21+
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
22+
23+
RUN --mount=type=cache,target=/var/cache/tdnf \
24+
tdnf install -y \
25+
wget \
26+
awk \
27+
tar \
28+
ca-certificates
29+
30+
RUN echo ${PS_PACKAGE_URL}
31+
32+
# Start a new stage so we lose all the package download layers from the final image
33+
FROM setup-tdnf-repa AS powershell
34+
35+
ARG PS_VERSION=7.4.0
36+
ARG PS_INSTALL_VERSION=7
37+
38+
# Define Args and Env needed to create links
39+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
40+
\
41+
# Define ENVs for Localization/Globalization
42+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
43+
LC_ALL=en_US.UTF-8 \
44+
LANG=en_US.UTF-8 \
45+
# set a fixed location for the Module analysis cache
46+
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
47+
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Mariner-2.0
48+
49+
RUN --mount=type=cache,target=/var/cache/tdnf \
50+
# install dependencies
51+
tdnf install -y \
52+
# required for localization
53+
icu \
54+
# required for help in PowerShell
55+
less \
56+
# required for SSH
57+
openssh-clients \
58+
dotnet-runtime-8.0 \
59+
ca-certificates
60+
61+
# Install dependencies and clean up
62+
RUN --mount=type=cache,target=/var/cache/tdnf \
63+
tdnf upgrade -y \
64+
# clean cached data
65+
&& tdnf clean all
66+
67+
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
68+
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
69+
rpm -i --nodeps /mnt/rpm/powershell.rpm
7170

72-
# Use PowerShell as the default shell
73-
# Use array to avoid Docker prepending /bin/sh -c
74-
CMD [ "pwsh" ]
71+
# Create the pwsh symbolic link that points to powershell
72+
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi
73+
74+
# intialize powershell module cache
75+
# and disable telemetry for this ONE session
76+
RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \
77+
&& pwsh \
78+
-NoLogo \
79+
-NoProfile \
80+
-Command " \
81+
\$ErrorActionPreference = 'Stop' ; \
82+
\$ProgressPreference = 'SilentlyContinue' ; \
83+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
84+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
85+
Start-Sleep -Seconds 6 ; \
86+
}"
87+
88+
# Use PowerShell as the default shell
89+
# Use array to avoid Docker prepending /bin/sh -c
90+
CMD [ "pwsh" ]

release/7-4/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-${PS_VERSION}-1.cm.aarch64.rpm",
55
"osVersion": "Mariner 2.0 ARM 64v7",
66
"SkipGssNtlmSspTests": true,
77
"ShortDistroName": "mariner",

release/7-4/mariner2/docker/Dockerfile

Lines changed: 78 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,99 +3,89 @@
33

44
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS setup-tdnf-repa
55

6-
RUN --mount=type=cache,target=/var/cache/tdnf \
7-
tdnf install -y mariner-repos-microsoft-preview \
8-
&& tdnf makecache
6+
RUN --mount=type=cache,target=/var/cache/tdnf \
7+
tdnf install -y mariner-repos-microsoft-preview \
8+
&& tdnf makecache
99

10-
# Move to
10+
# Download packages into a container so they don't take up space in the final stage
1111
FROM setup-tdnf-repa AS installer-env
1212

13-
# Define Args for the needed to add the package
14-
ARG PS_VERSION=7.3.0-preview.8
15-
ARG PACKAGE_VERSION=7.3.0_preview.8
16-
ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.x86_64.rpm
17-
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
18-
ARG PS_INSTALL_VERSION=7-preview
19-
20-
# Download the Linux tar.gz and save it
21-
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
22-
23-
RUN --mount=type=cache,target=/var/cache/tdnf \
24-
tdnf install -y \
25-
wget \
26-
awk \
27-
tar \
28-
ca-certificates
13+
# Define Args for the needed to add the package
14+
ARG PS_VERSION=7.3.0-preview.8
15+
ARG PACKAGE_VERSION=7.3.0_preview.8
16+
ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.cm.x86_64.rpm
17+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
18+
ARG PS_INSTALL_VERSION=7-preview
19+
20+
# Download the Linux tar.gz and save it
21+
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
2922

30-
RUN --mount=type=cache,target=/var/cache/tdnf \
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 8.0 -Quality preview -Runtime dotnet -InstallDir /usr/share/dotnet
23+
RUN --mount=type=cache,target=/var/cache/tdnf \
24+
tdnf install -y \
25+
wget \
26+
awk \
27+
tar \
28+
ca-certificates
3629

37-
RUN echo ${PS_PACKAGE_URL}
30+
RUN echo ${PS_PACKAGE_URL}
3831

39-
# Start a new stage so we lose all the tar.gz layers from the final image
32+
# Start a new stage so we lose all the package download layers from the final image
4033
FROM setup-tdnf-repa AS powershell
4134

42-
ARG PS_VERSION=7.3.0-preview.8
43-
ARG PS_INSTALL_VERSION=7-preview
44-
45-
# Define Args and Env needed to create links
46-
ARG PS_INSTALL_VERSION=7-preview
47-
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
48-
\
49-
# Define ENVs for Localization/Globalization
50-
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
51-
LC_ALL=en_US.UTF-8 \
52-
LANG=en_US.UTF-8 \
53-
# set a fixed location for the Module analysis cache
54-
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
55-
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Mariner-2.0
56-
57-
RUN --mount=type=cache,target=/var/cache/tdnf \
58-
# install dependencies
59-
tdnf install -y \
60-
# required for localization
61-
icu \
62-
# required for help in PowerShell
63-
less \
64-
# required for SSH
65-
openssh-clients \
66-
ca-certificates
67-
68-
# Install dependencies and clean up
69-
RUN --mount=type=cache,target=/var/cache/tdnf \
70-
tdnf upgrade -y \
71-
# clean cached data
72-
&& tdnf clean all
73-
74-
COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet
75-
76-
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
77-
78-
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
79-
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
80-
rpm -i --nodeps /mnt/rpm/powershell.rpm
81-
82-
# Create the pwsh symbolic link that points to powershell
83-
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi
84-
85-
# intialize powershell module cache
86-
# and disable telemetry for this ONE session
87-
RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \
88-
&& pwsh \
89-
-NoLogo \
90-
-NoProfile \
91-
-Command " \
92-
\$ErrorActionPreference = 'Stop' ; \
93-
\$ProgressPreference = 'SilentlyContinue' ; \
94-
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
95-
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
96-
Start-Sleep -Seconds 6 ; \
97-
}"
98-
99-
# Use PowerShell as the default shell
100-
# Use array to avoid Docker prepending /bin/sh -c
101-
CMD [ "pwsh" ]
35+
ARG PS_VERSION=7.3.0-preview.8
36+
ARG PS_INSTALL_VERSION=7-preview
37+
38+
# Define Args and Env needed to create links
39+
ARG PS_INSTALL_VERSION=7-preview
40+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
41+
\
42+
# Define ENVs for Localization/Globalization
43+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
44+
LC_ALL=en_US.UTF-8 \
45+
LANG=en_US.UTF-8 \
46+
# set a fixed location for the Module analysis cache
47+
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
48+
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Mariner-2.0
49+
50+
RUN --mount=type=cache,target=/var/cache/tdnf \
51+
# install dependencies
52+
tdnf install -y \
53+
# required for localization
54+
icu \
55+
# required for help in PowerShell
56+
less \
57+
# required for SSH
58+
openssh-clients \
59+
dotnet-runtime-8.0 \
60+
ca-certificates
61+
62+
# Install dependencies and clean up
63+
RUN --mount=type=cache,target=/var/cache/tdnf \
64+
tdnf upgrade -y \
65+
# clean cached data
66+
&& tdnf clean all
67+
68+
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
69+
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
70+
rpm -i --nodeps /mnt/rpm/powershell.rpm
71+
72+
# Create the pwsh symbolic link that points to powershell
73+
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi
74+
75+
# intialize powershell module cache
76+
# and disable telemetry for this ONE session
77+
RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \
78+
&& pwsh \
79+
-NoLogo \
80+
-NoProfile \
81+
-Command " \
82+
\$ErrorActionPreference = 'Stop' ; \
83+
\$ProgressPreference = 'SilentlyContinue' ; \
84+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
85+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
86+
Start-Sleep -Seconds 6 ; \
87+
}"
88+
89+
# Use PowerShell as the default shell
90+
# Use array to avoid Docker prepending /bin/sh -c
91+
CMD [ "pwsh" ]

0 commit comments

Comments
 (0)