-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphellams-automator.dockerfile
95 lines (77 loc) · 4.37 KB
/
phellams-automator.dockerfile
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
85
86
87
88
89
90
91
92
93
94
95
# Use Debian latest as the base image
FROM debian:12.9-slim
# Set environment variables for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt update && \
apt install -y \
curl \
wget \
gnupg \
apt-transport-https \
software-properties-common \
ca-certificates
RUN wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.5/powershell_7.4.5-1.deb_amd64.deb -O /tmp/powershell.deb && \
dpkg -i /tmp/powershell.deb && \
apt install -f -y # Fix dependencies if needed
# Install PowerShell 7.4.5
#RUN apt install -y powershell
# Install NuGet
RUN apt install -y nuget
# Install Chocolatey (using the script)
# RUN mkdir -p /opt/chocolatey && \
# curl -L https://chocolatey.org/install.ps1 -o /opt/chocolatey/install.ps1 && \
# chmod +x /opt/chocolatey/install.ps1 && \
# pwsh -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; /opt/chocolatey/install.ps1"
# Install .net 8SDK
RUN wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh && \
chmod +x /tmp/dotnet-install.sh && \
/tmp/dotnet-install.sh --channel 8.0
# Set environment variables globally for all shells
ENV DOTNET_ROOT=/root/.dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
# Install PowerShell Modules from PSGallery
RUN pwsh -command 'Find-Module -Name Pester -RequiredVersion 5.5.0 -Repository PSGallery | Install-Module -Force' && \
pwsh -command 'Find-Module -Name PSScriptAnalyzer -Repository PSGallery | Install-Module -Force' && \
pwsh -command 'Find-Module -Name powershell-yaml -Repository PSGallery | Install-Module -Force'
# Add installed and copied modules to profile
# Add Custom output with ascii art and included software versions
# RUN touch /root/.config/powershell/Microsoft.PowerShell_profile.ps1 && \
# echo 'Import-Module -Name Pester' >> /root/.config/powershell/Microsoft.PowerShell_profile.ps1 && \
# echo 'Import-Module -Name PSScriptAnalyzer' >> /root/.config/powershell/Microsoft.PowerShell_profile.ps1 && \
# echo 'Import-Module -Name powershell-yaml' >> /root/.config/powershell/Microsoft.PowerShell_profile.ps1 && \
# echo '[Console]::write("---------------------[pwsh-version: $($PSVersionTable.PSVersion.ToString())]`n")' && \
# echo '[Console]::write("---------------------[nuget-version: $(nuget help | select -First 1]`n")' && \
# echo '[Console]::write("---------------------[dotnet-version: $($(dotnet --info).Where({$_ -like "*Version*"}).replace(" ","-")]`n")'
RUN wget -qO- 'https://keybase.io/codecovsecurity/pgp_keys.asc' | gpg --no-default-keyring --keyring /root/trustedkeys.gpg --import && \
wget 'https://uploader.codecov.io/latest/linux/codecov' && \
wget 'https://uploader.codecov.io/latest/linux/codecov.SHA256SUM' && \
wget 'https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig' && \
gpg --no-default-keyring --keyring /root/trustedkeys.gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
RUN shasum -a 256 -c codecov.SHA256SUM && \
chmod +x codecov && \
mv codecov /usr/local/bin/codecov && \
codecov --help
# Verify installations
RUN pwsh -Command '$PSVersionTable.PSVersion.ToString()' && \
pwsh -command 'nuget help | select -First 1' && \
pwsh -command 'dotnet --info'
# quicklog psmpacker, nupsforge, csverfy dependencies
COPY ./includes/modules/quicklog /root/.local/share/powershell/Modules/quicklog
# copy psmpacker
COPY ./includes/modules/psmpacker /root/.local/share/powershell/Modules/psmpacker
# copy nupsforge
COPY ./includes/modules/nupsforge /root/.local/share/powershell/Modules/nupsforge
# copy csverfy
COPY ./includes/modules/csverify /root/.local/share/powershell/Modules/csverify
# Copy local cmdlets to /root/.config/powershell
COPY ./includes/modules/colorconsole /root/.local/share/powershell/Modules/colorconsole
COPY ./includes/modules/gitautoversion /root/.local/share/powershell/Modules/gitautoversion
COPY ./includes/acsiilogo-template.txt /root/.config/powershell/acsiilogo-template.txt
# copy template profile
COPY ./includes/Microsoft.PowerShell_profile.ps1 /root/.config/powershell/Microsoft.PowerShell_profile.ps1
# Set PowerShell as the default shell
CMD ["pwsh"]
# Custom profile
#ENTRYPOINT ["pwsh", "-File", "/root/.config/powershell/Microsoft.PowerShell_profile.ps1"]
#ENTRYPOINT ["pwsh"]