|
1 | 1 | # Copyright 2023-2024 Broadcom. All Rights Reserved.
|
2 | 2 | # SPDX-License-Identifier: BSD-2
|
3 | 3 |
|
4 |
| -FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 |
| 4 | +# Use the base Ubuntu devcontainer image. |
| 5 | +FROM mcr.microsoft.com/devcontainers/base:ubuntu |
5 | 6 |
|
6 |
| -# Install additional packages unavailable in the base image or as a feature. |
7 |
| -# Note: Unable to be installed used the "postCreateCommand" option. |
| 7 | +# Install additional packages. |
8 | 8 | RUN apt-get update && \
|
9 |
| - apt-get install -y jq xorriso whois && \ |
10 |
| - apt-get autoremove -y && \ |
| 9 | + apt-get install -y apt-transport-https curl git jq software-properties-common unzip wget whois xorriso ca-certificates |
| 10 | + |
| 11 | +RUN update-ca-certificates |
| 12 | + |
| 13 | +# Install Packer using the latest release. |
| 14 | +RUN PACKER_VERSION=$(curl -s https://api.github.com/repos/hashicorp/packer/releases/latest | jq -r .tag_name | sed 's/^v//') && \ |
| 15 | + echo "Latest Packer Version: ${PACKER_VERSION}." && \ |
| 16 | + PACKER_URL="https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip" && \ |
| 17 | + echo "Downloading Packer from ${PACKER_URL}..." && \ |
| 18 | + wget --no-check-certificate -q -O packer_${PACKER_VERSION}_linux_amd64.zip ${PACKER_URL} || { echo "Error: Failed to download."; wget --no-check-certificate ${PACKER_URL}; exit 1; } && \ |
| 19 | + echo "Installing Packer ${PACKER_VERSION}..." && \ |
| 20 | + unzip -o packer_${PACKER_VERSION}_linux_amd64.zip || { echo "Failed to unzip the download."; exit 1; } && \ |
| 21 | + mv packer /usr/local/bin/ || { echo "Error: Failed to move binary."; exit 1; } && \ |
| 22 | + rm packer_${PACKER_VERSION}_linux_amd64.zip || { echo "Error: Failed to remove download."; exit 1; } |
| 23 | + |
| 24 | +# Install Terraform using the latest release. |
| 25 | +RUN TERRAFORM_VERSION=$(curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r .tag_name | sed 's/^v//') && \ |
| 26 | + echo "Latest Terraform Version: ${TERRAFORM_VERSION}." && \ |
| 27 | + TERRAFORM_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \ |
| 28 | + echo "Downloading Terraform from ${TERRAFORM_URL}..." && \ |
| 29 | + wget --no-check-certificate -q -O terraform_${TERRAFORM_VERSION}_linux_amd64.zip ${TERRAFORM_URL} || { echo "Error: Failed to download."; wget --no-check-certificate ${TERRAFORM_URL}; exit 1; } && \ |
| 30 | + echo "Installing Terraform ${TERRAFORM_VERSION}..." && \ |
| 31 | + unzip -o terraform_${TERRAFORM_VERSION}_linux_amd64.zip || { echo "Error: Failed to unzip the download."; exit 1; } && \ |
| 32 | + mv terraform /usr/local/bin/ || { echo "Error: Failed to the move binary."; exit 1; } && \ |
| 33 | + rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip || { echo "Error: Failed to remove download."; exit 1; } |
| 34 | + |
| 35 | +# Install Gomplate using the latest release. |
| 36 | +RUN GOMPLATE_VERSION=$(wget --no-check-certificate -q -O - https://api.github.com/repos/hairyhenderson/gomplate/releases/latest | jq -r .tag_name | sed 's/^v//') && \ |
| 37 | + echo "Latest Gomplate Version: ${GOMPLATE_VERSION}." && \ |
| 38 | + GOMPLATE_URL="https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64" && \ |
| 39 | + echo "Downloading Gomplate ${GOMPLATE_VERSION}..." && \ |
| 40 | + wget --no-check-certificate -q -O gomplate_linux-amd64 ${GOMPLATE_URL} || { echo "Error: Failed to download."; exit 1; } && \ |
| 41 | + echo "Installing Gomplate ${GOMPLATE_VERSION}..." && \ |
| 42 | + chmod +x gomplate_linux-amd64 && \ |
| 43 | + mv gomplate_linux-amd64 /usr/local/bin/gomplate || { echo "Error: Failed to move binary."; exit 1; } |
| 44 | + |
| 45 | +# Install PowerShell using the latest release. |
| 46 | +RUN PWSH_VERSION=$(wget --no-check-certificate -q -O - https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r .tag_name | sed 's/^v//') && \ |
| 47 | + echo "Latest PowerShell Version: ${PWSH_VERSION}." && \ |
| 48 | + PWSH_DEB_URL=$(wget --no-check-certificate -q -O - https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r '.assets[] | select(.name | endswith("amd64.deb")).browser_download_url' | head -n 1) && \ |
| 49 | + echo "Downloading PowerShell ${PWSH_VERSION}..." && \ |
| 50 | + wget --no-check-certificate -q $PWSH_DEB_URL || { echo "Error: Failed to download."; exit 1; } && \ |
| 51 | + echo "Installing PowerShell ${PWSH_VERSION}..." && \ |
| 52 | + dpkg -i $(basename $PWSH_DEB_URL) || { echo "Error: Failed to install PowerShell."; exit 1; } && \ |
| 53 | + rm $(basename $PWSH_DEB_URL) || { echo "Error: Failed to remove download."; exit 1; } |
| 54 | + |
| 55 | +# Install Python3 and Ansible. |
| 56 | +RUN add-apt-repository --yes --update ppa:ansible/ansible && \ |
| 57 | + apt-get update && \ |
| 58 | + apt-get install -y python3 python3-pip ansible |
| 59 | + |
| 60 | +# Cleanup. |
| 61 | +RUN apt-get autoremove -y && \ |
11 | 62 | apt-get clean && \
|
12 | 63 | rm -rf /var/lib/apt/lists/*
|
| 64 | + |
| 65 | +# Set PATH |
| 66 | +ENV PATH="$HOME/.local/bin:$PATH" |
0 commit comments