Skip to content

Commit

Permalink
Merge pull request Azure#421 from surajssd/consolidate-powershell-setup
Browse files Browse the repository at this point in the history
base & tools: Consolidate PowerShell setup
  • Loading branch information
surajssd authored Jun 26, 2024
2 parents 0fefb10 + f170918 commit 31b483c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
9 changes: 0 additions & 9 deletions linux/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,3 @@ RUN gem install bundler --no-document --clear-sources --force \
ENV GEM_HOME=~/bundle
ENV BUNDLE_PATH=~/bundle
ENV PATH=$PATH:$GEM_HOME/bin:$BUNDLE_PATH/gems/bin

# PowerShell telemetry
ENV POWERSHELL_DISTRIBUTION_CHANNEL CloudShell
# don't tell users to upgrade, they can't
ENV POWERSHELL_UPDATECHECK Off

# Copy and run script to Install powershell modules
COPY ./linux/powershell/ powershell
RUN /usr/bin/pwsh -File ./powershell/setupPowerShell.ps1 -image Base && rm -rf ./powershell
19 changes: 13 additions & 6 deletions linux/tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,20 @@ RUN mkdir -p /usr/share/ansible/collections/ansible_collections/azure/azcollecti
&& wget -nv -q -O /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements.txt https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements.txt \
&& /opt/ansible/bin/python -m pip install -r /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements.txt

# Copy and run script to Install powershell modules and setup Powershell machine profile
COPY ./linux/powershell/PSCloudShellUtility/ /usr/local/share/powershell/Modules/PSCloudShellUtility/
COPY ./linux/powershell/ powershell
RUN /usr/bin/pwsh -File ./powershell/setupPowerShell.ps1 -image Top && rm -rf ./powershell
# Powershell telemetry
ENV POWERSHELL_DISTRIBUTION_CHANNEL=CloudShell \
# don't tell users to upgrade, they can't
POWERSHELL_UPDATECHECK=Off

# install powershell warmup script
COPY ./linux/powershell/Invoke-PreparePowerShell.ps1 linux/powershell/Invoke-PreparePowerShell.ps1
# Copy and run script to install Powershell modules and setup Powershell machine profile
COPY ./linux/powershell/ powershell
RUN /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
Expand Down

0 comments on commit 31b483c

Please sign in to comment.