Skip to content

Commit 292b7ae

Browse files
feat(packer): use ubuntu 24.04, powershell 7.5.4, and packer 1.14.2
1 parent bb9e991 commit 292b7ae

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

Dockerfile.packer

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
22

33
RUN apt-get update && \
44
DEBIAN_FRONTEND=noninteractive apt-get install -y openvpn \
@@ -12,16 +12,40 @@ RUN apt-get update && \
1212
apt-transport-https \
1313
software-properties-common
1414

15+
# https://learn.microsoft.com/en-us/powershell/scripting/install/install-other-linux?view=powershell-7.5#installation-using-a-binary-archive-file
16+
RUN ARCH=$(uname -m) && \
17+
if [ "$ARCH" = "x86_64" ]; then \
18+
SELECTED_ARCH="x64"; \
19+
elif [ "$ARCH" = "aarch64" ]; then \
20+
SELECTED_ARCH="arm64"; \
21+
else \
22+
echo "Unsupported architecture: $ARCH"; exit 1; \
23+
fi && \
24+
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-linux-${SELECTED_ARCH}.tar.gz && \
25+
mkdir -p /opt/microsoft/powershell/7 && \
26+
tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 && \
27+
chmod +x /opt/microsoft/powershell/7/pwsh && \
28+
ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
29+
30+
# https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-linux-arm64.tar.gz
1531
# https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu?view=powershell-7.4
16-
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
17-
dpkg -i packages-microsoft-prod.deb && \
18-
rm packages-microsoft-prod.deb && \
19-
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y powershell
32+
#RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
33+
# dpkg -i packages-microsoft-prod.deb && \
34+
# rm packages-microsoft-prod.deb && \
35+
# apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y powershell
2036

2137
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
2238

2339
# https://developer.hashicorp.com/packer/install#linux
24-
RUN curl -fsSL -o packer.zip https://releases.hashicorp.com/packer/1.10.2/packer_1.10.2_linux_amd64.zip && \
40+
RUN ARCH=$(uname -m) && \
41+
if [ "$ARCH" = "x86_64" ]; then \
42+
SELECTED_ARCH="amd64"; \
43+
elif [ "$ARCH" = "aarch64" ]; then \
44+
SELECTED_ARCH="arm64"; \
45+
else \
46+
echo "Unsupported architecture: $ARCH"; exit 1; \
47+
fi && \
48+
curl -fsSL -o packer.zip https://releases.hashicorp.com/packer/1.14.2/packer_1.14.2_linux_${SELECTED_ARCH}.zip && \
2549
unzip -q packer.zip && rm packer.zip && \
2650
install -m 0755 packer /usr/bin/packer
2751

0 commit comments

Comments
 (0)