Last active
November 29, 2023 20:30
-
-
Save timgabrhel/1e2a6f48b2ebf341686eb2af0aa2ff95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) Microsoft Corporation. | |
# Licensed under the MIT License. | |
FROM ubuntu:20.04 | |
# Instructs apt-get to run without a terminal | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Terraform, providers and tflint versions | |
ARG AZURERM_VERSION=3.23.0 | |
ARG RANDOM_VERSION=3.4.3 | |
ARG TIME_VERSION=0.8.0 | |
ARG TFLINT_VERSION=0.40.0 | |
ARG TFLINT_AZURERM=0.18.0 | |
# Azure CLI version | |
ARG AZURE_CLI_VERSION=2.54.0-1~focal | |
# Bicep version | |
ARG BICEP_VERSION=v0.10.61 | |
# Update distro (software-properties-common installs the add-apt-repository command) | |
RUN apt-get update \ | |
&& apt-get -y install --no-install-recommends apt-utils software-properties-common 2>&1 \ | |
&& apt-get dist-upgrade -y | |
# Install prerequisites | |
RUN add-apt-repository ppa:git-core/ppa \ | |
&& apt-get install -y \ | |
apt-transport-https \ | |
wget \ | |
unzip \ | |
git \ | |
ca-certificates \ | |
curl \ | |
lsb-release \ | |
jq \ | |
gnupg \ | |
sudo \ | |
shellcheck \ | |
nano | |
# Install the Microsoft package key | |
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ | |
&& dpkg -i packages-microsoft-prod.deb \ | |
&& rm packages-microsoft-prod.deb | |
# Install the Microsoft signing key | |
RUN curl -sL https://packages.microsoft.com/keys/microsoft.asc | \ | |
gpg --dearmor | \ | |
tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null | |
# Install the AZ CLI repository | |
RUN AZ_REPO=$(lsb_release -cs) \ | |
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \ | |
tee /etc/apt/sources.list.d/azure-cli.list | |
# Install AZ CLI | |
RUN apt-get update && apt-get install -y azure-cli=${AZURE_CLI_VERSION} | |
# Install kubectl & kubelogin | |
RUN az aks install-cli \ | |
&& az cloud set -n AzureUSGovernment | |
# Clean up | |
RUN apt-get autoremove -y \ | |
&& apt-get clean -y \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Add the mlzwlmgmt user | |
ARG USERNAME=mlzwlmgmt | |
ARG USER_UID=1000 | |
ARG USER_GID=$USER_UID | |
RUN useradd -s /bin/bash --uid $USER_UID -m $USERNAME \ | |
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | |
&& chmod 0440 /etc/sudoers.d/$USERNAME | |
# Install Brew & k9s | |
RUN useradd -ms /bin/bash linuxbrew | |
USER linuxbrew | |
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \ | |
&& mkdir ~/.linuxbrew/bin \ | |
&& ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin \ | |
&& eval $(~/.linuxbrew/bin/brew shellenv) \ | |
&& brew --version \ | |
&& brew install gcc \ | |
&& brew install k9s \ | |
&& brew install helm | |
# Add brew to the path | |
ENV PATH=/home/linuxbrew/.linuxbrew/bin:$PATH | |
# Run as the mlzwlmgmt user | |
USER $USERNAME | |
# Reset to the default value | |
ENV DEBIAN_FRONTEND=dialog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment