Skip to content

Commit 7842215

Browse files
authored
Add support for Ubuntu24.04 (#828)
* initial commit for ubuntu24.04 support * fix PS_PACKAGE for stable file * refer to latest preview release .deb * add ubuntu 24.04 arm32 image * can't add support for stable until PMC change is backported in next stable release * use original libssl3 package * use sudo with tar command * install sudo * change platform from v7 to v8 * remove arm32 image
1 parent 68ff6c7 commit 7842215

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Docker image file that describes an Ubuntu20.04 image with PowerShell installed from Microsoft APT Repo
5+
ARG hostRegistry=psdockercache.azurecr.io
6+
FROM ${hostRegistry}/ubuntu:24.04 AS installer-env
7+
8+
# Define Args for the needed to add the package
9+
ARG PS_VERSION=7.5.0-preview.5
10+
ARG PS_PACKAGE=powershell-preview_${PS_VERSION}-1.deb_amd64.deb
11+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
12+
ARG PS_INSTALL_VERSION=7-preview
13+
14+
RUN --mount=type=cache,target=/var/lib/apt \
15+
--mount=type=cache,target=/var/cache/apt \
16+
apt-get update \
17+
&& apt-get install --no-install-recommends -y \
18+
# curl is required to grab the Linux package
19+
curl \
20+
# less is required for help in powershell
21+
less \
22+
# requied to setup the locale
23+
locales \
24+
# required for SSL
25+
ca-certificates \
26+
# Download the Linux package and save it
27+
&& echo ${PS_PACKAGE_URL} \
28+
&& curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.deb
29+
30+
# Install the deb file in this image and make powershell available
31+
ARG hostRegistry=psdockercache.azurecr.io
32+
FROM ${hostRegistry}/ubuntu:24.04 AS final-image
33+
34+
# # Define args needed to add the package
35+
ARG PS_VERSION=7.5.0-preview.5
36+
ARG PS_PACKAGE=powershell-preview_${PS_VERSION}-1.deb_amd64.deb
37+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
38+
ARG PS_INSTALL_VERSION=7-preview
39+
40+
# Define ENVs for Localization/Globalization
41+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
42+
LC_ALL=en_US.UTF-8 \
43+
LANG=en_US.UTF-8 \
44+
PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
45+
# set a fixed location for the Module analysis cache
46+
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
47+
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Ubuntu-24.04
48+
49+
# Install dependencies and clean up
50+
RUN --mount=from=installer-env,target=/mnt/pwsh,source=/tmp \
51+
--mount=type=cache,target=/var/lib/apt \
52+
--mount=type=cache,target=/var/cache/apt \
53+
apt-get update \
54+
&& apt-get install --no-install-recommends -y /mnt/pwsh/powershell.deb \
55+
&& apt-get install --no-install-recommends -y \
56+
# less is required for help in powershell
57+
less \
58+
# requied to setup the locale
59+
locales \
60+
# required for SSL
61+
ca-certificates \
62+
gss-ntlmssp \
63+
libicu74 \
64+
libssl3 \
65+
libc6 \
66+
libgcc1 \
67+
libgssapi-krb5-2 \
68+
liblttng-ust1 \
69+
libstdc++6 \
70+
zlib1g \
71+
# PowerShell remoting over SSH dependencies
72+
openssh-client \
73+
&& apt-get dist-upgrade -y \
74+
&& locale-gen $LANG && update-locale \
75+
&& export POWERSHELL_TELEMETRY_OPTOUT=1 \
76+
# Give all user execute permissions and remove write permissions for others
77+
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
78+
# Create the pwsh symbolic link that points to powershell
79+
&& ln -sf ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
80+
# Create the pwsh-preview symbolic link that points to powershell
81+
&& ln -sf ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \
82+
&& pwsh \
83+
-NoLogo \
84+
-NoProfile \
85+
-Command " \
86+
\$ErrorActionPreference = 'Stop' ; \
87+
\$ProgressPreference = 'SilentlyContinue' ; \
88+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
89+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
90+
Start-Sleep -Seconds 6 ; \
91+
}"
92+
93+
# Use PowerShell as the default shell
94+
# Use array to avoid Docker prepending /bin/sh -c
95+
CMD [ "pwsh-preview" ]

release/7-5/ubuntu24.04/meta.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"IsLinux" : true,
3+
"UseLinuxVersion": false,
4+
"PackageFormat": "powershell${channelTag}_${PS_VERSION}-1.deb_amd64.deb",
5+
"osVersion": "Ubuntu 24.04",
6+
"SkipGssNtlmSspTests": false,
7+
"ShortDistroName": "ubuntu",
8+
"shortTags": [
9+
{"Tag": "noble"},
10+
{"Tag": "24.04"}
11+
],
12+
"manifestLists": [
13+
"${channelTag}"
14+
],
15+
"TestProperties": {
16+
"size": 337
17+
},
18+
"SubImage": "test-deps",
19+
"EndOfLife": "2029-04-01",
20+
"DistributionState": "Validating"
21+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Docker image file that describes an Ubuntu image with PowerShell and test dependencies
2+
ARG BaseImage=mcr.microsoft.com/powershell:ubuntu-24.04
3+
4+
FROM ${BaseImage}
5+
6+
# Install dependencies and clean up
7+
RUN --mount=type=cache,target=/var/lib/apt/lists \
8+
apt-get update \
9+
&& apt-get install --no-install-recommends -y \
10+
sudo \
11+
curl \
12+
wget \
13+
iputils-ping \
14+
iputils-tracepath \
15+
git \
16+
unzip \
17+
&& apt-get clean
18+
19+
ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Ubuntu-24.04
20+
21+
# Use PowerShell as the default shell
22+
# Use array to avoid Docker prepending /bin/sh -c
23+
CMD [ "pwsh" ]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"IsLinux" : true,
3+
"UseLinuxVersion": false,
4+
"osVersion": "Ubuntu 24.04",
5+
"tagTemplates": [
6+
"ubuntu-#shorttag#"
7+
],
8+
"SubRepository": "test-deps",
9+
"OptionalTests": [
10+
"test-deps",
11+
"test-deps-debian"
12+
],
13+
"TestProperties": {
14+
"size": 390
15+
}
16+
}

0 commit comments

Comments
 (0)