-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathtools.Dockerfile
More file actions
84 lines (69 loc) · 4.22 KB
/
tools.Dockerfile
File metadata and controls
84 lines (69 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# IMAGE_LOCATION refers to a Microsoft-internal container registry which stores a cached version
# of the image built from base.Dockerfile. If you are building this file outside Microsoft, you
# won't be able to reach this location, but don't worry!
# To build yourself locally, override this location with a local image tag. See README.md for more detail
ARG IMAGE_LOCATION=cloudconregtest.azurecr.io/cloudshell:base.master.548d49ff.20250719.3
# Copy from base build
FROM ${IMAGE_LOCATION}
LABEL org.opencontainers.image.source="https://github.com/Azure/CloudShell"
RUN tdnf clean all && \
tdnf repolist --refresh && \
ACCEPT_EULA=Y tdnf update -y && \
# Install latest Azure CLI package. CLI team drops latest (pre-release) package here prior to public release
# We don't support using this location elsewhere - it may be removed or updated without notice
wget https://azurecliprod.blob.core.windows.net/cloudshell-release/azure-cli-latest-azurelinux3.0.rpm \
&& tdnf install -y ./azure-cli-latest-azurelinux3.0.rpm \
&& rm azure-cli-latest-azurelinux3.0.rpm && \
tdnf clean all && \
rm -rf /var/cache/tdnf/*
# Install any Azure CLI extensions that should be included by default.
RUN --mount=type=secret,id=pip_index_url,target=/run/secrets/pip_index_url \
echo "Using Azure Artifacts feed: $(cat /run/secrets/pip_index_url)" && \
export PIP_VERBOSE=1 && \
az extension add --system --name ssh -y --pip-extra-index-urls "$(cat /run/secrets/pip_index_url)" --verbose --debug \
&& az extension add --system --name ml -y --pip-extra-index-urls "$(cat /run/secrets/pip_index_url)" --verbose --debug
# Install kubectl
RUN --mount=type=secret,id=pip_index_url,target=/run/secrets/pip_index_url \
export PIP_INDEX_URL=$(cat /run/secrets/pip_index_url) && \
az aks install-cli \
&& chmod +x /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubelogin
# Install azure-functions-core-tools
RUN wget -nv -O Azure.Functions.Cli.zip `curl -fSsL https://api.github.com/repos/Azure/azure-functions-core-tools/releases/latest | grep "url.*linux-x64" | grep -v "sha2" | cut -d '"' -f4` \
&& unzip -d azure-functions-cli Azure.Functions.Cli.zip \
&& chmod +x azure-functions-cli/func \
&& chmod +x azure-functions-cli/gozip \
&& mv -v azure-functions-cli /opt \
&& ln -sf /opt/azure-functions-cli/func /usr/bin/func \
&& ln -sf /opt/azure-functions-cli/gozip /usr/bin/gozip \
&& rm -r Azure.Functions.Cli.zip
RUN mkdir -p /usr/cloudshell
WORKDIR /usr/cloudshell
# Powershell telemetry
ENV POWERSHELL_DISTRIBUTION_CHANNEL=CloudShell \
# don't tell users to upgrade, they can't
POWERSHELL_UPDATECHECK=Off
# Copy and run script to install Powershell modules and setup Powershell machine profile
COPY ./linux/powershell/ powershell
RUN --mount=type=secret,id=pip_index_url,target=/run/secrets/pip_index_url \
cp ./powershell/libs/libmi.so /opt/microsoft/powershell/7/libmi.so && \
# Set environment variables for PowerShell to potentially use Azure Artifacts feed
export NUGET_SOURCE=$(cat /run/secrets/pip_index_url | sed 's|/simple/|/nuget/v2|') && \
# Temporarily override PowerShell Gallery URL in the setup script to use Azure Artifacts feed
sed -i "s|https://www.powershellgallery.com/api/v2|$NUGET_SOURCE|g" ./powershell/setupPowerShell.ps1 && \
/usr/bin/pwsh -File ./powershell/setupPowerShell.ps1 -image Base && \
cp -r ./powershell/PSCloudShellUtility /usr/local/share/powershell/Modules/PSCloudShellUtility/ && \
/usr/bin/pwsh -File ./powershell/setupPowerShell.ps1 -image Top && \
# Install Powershell warmup script
mkdir -p linux/powershell && \
cp powershell/Invoke-PreparePowerShell.ps1 linux/powershell/Invoke-PreparePowerShell.ps1 && \
rm -rf ./powershell
# Remove su so users don't have su access by default.
RUN rm -f ./linux/Dockerfile && rm -f /bin/su
# Add user's home directories to PATH at the front so they can install tools which
# override defaults
# Add dotnet tools to PATH so users can install a tool using dotnet tools and can execute that command from any directory
ENV PATH ~/.local/bin:~/bin:~/.dotnet/tools:$PATH
ENV AZURE_CLIENTS_SHOW_SECRETS_WARNING True
# Set AZUREPS_HOST_ENVIRONMENT
ENV AZUREPS_HOST_ENVIRONMENT cloud-shell/1.0