1
1
# Copyright (c) Microsoft Corporation.
2
2
# Licensed under the MIT License.
3
3
4
- FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS installer-env
4
+ FROM 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
+ # Move to
11
+ FROM setup-tdnf-repa AS installer-env
5
12
6
13
# Define Args for the needed to add the package
7
14
ARG PS_VERSION=7.3.0-preview.8
@@ -13,10 +20,24 @@ ARG PS_INSTALL_VERSION=7-preview
13
20
# Download the Linux tar.gz and save it
14
21
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
15
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 --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
36
+
16
37
RUN echo ${PS_PACKAGE_URL}
17
38
18
39
# Start a new stage so we lose all the tar.gz layers from the final image
19
- FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS powershell
40
+ FROM setup-tdnf-repa AS powershell
20
41
21
42
ARG PS_VERSION=7.3.0-preview.8
22
43
ARG PS_INSTALL_VERSION=7-preview
@@ -33,28 +54,30 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
33
54
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
34
55
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Mariner-2.0
35
56
36
- # Install dependencies and clean up
37
57
RUN --mount=type=cache,target=/var/cache/tdnf \
38
- tdnf install -y mariner-repos-microsoft-preview \
39
- && tdnf makecache \
40
58
# install dependencies
41
- && tdnf install -y \
59
+ tdnf install -y \
42
60
# required for localization
43
61
icu \
44
62
# required for help in PowerShell
45
63
less \
46
64
# required for SSH
47
65
openssh-clients \
48
- ca-certificates \
49
- dotnet-runtime-7.0 \
50
- # upgrade packages
51
- && tdnf upgrade -y \
66
+ ca-certificates
67
+
68
+ # Install dependencies and clean up
69
+ RUN --mount=type=cache,target=/var/cache/tdnf \
70
+ tdnf upgrade -y \
52
71
# clean cached data
53
72
&& tdnf clean all
54
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
+
55
78
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
56
79
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
57
- rpm -i /mnt/rpm/powershell.rpm
80
+ rpm -i --nodeps /mnt/rpm/powershell.rpm
58
81
59
82
# Create the pwsh symbolic link that points to powershell
60
83
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi
0 commit comments