@@ -4,6 +4,8 @@ FROM registry.access.redhat.com/ubi9/ubi:latest
44LABEL org.opencontainers.image.title=rhel
55LABEL org.opencontainers.image.source=https://github.com/libre-devops/terraform-azure-azdo-pipeline-templates
66
7+ RUN rm -rf /bin/sh && ln -sf /bin/bash /bin/sh
8+
79# Set args with blank values - these will be over-written with the CLI
810ARG NORMAL_USER=builder
911ARG DEBIAN_FRONTEND=noninteractive
@@ -16,6 +18,8 @@ ENV TARGETARCH ${TARGETARCH}
1618
1719# Environment variables for pyenv
1820ENV HOME /home/${NORMAL_USER}
21+ ENV PYENV_ROOT /home/${NORMAL_USER}/.pyenv
22+ ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
1923
2024# Set path vars
2125ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt:/opt/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.local/bin:/home/${NORMAL_USER}/.local:/home/${NORMAL_USER}:/home/${NORMAL_USER}/.tenv:/home/${NORMAL_USER}/.tenv/bin:/home/${NORMAL_USER}/.pkenv:/home/${NORMAL_USER}/.pkenv/bin:/home/${NORMAL_USER}/.pyenv:/home/${NORMAL_USER}/.pyenv/bin:/home/${NORMAL_USER}/.pyenv/shims:/home/${NORMAL_USER}/.local/bin"
@@ -72,6 +76,13 @@ RUN POWERSHELL_RELEASE_URL=$(curl -s -L https://api.github.com/repos/PowerShell/
7276 ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh && \
7377 ln -s /usr/bin/pwsh /usr/bin/powershell
7478
79+ RUN git clone https://github.com/pyenv/pyenv.git /home/${NORMAL_USER}/.pyenv && \
80+ eval "$(pyenv init --path)" && \
81+ pyenvLatestStable=$(pyenv install --list | grep -v - | grep -E "^\s *[0-9]+\. [0-9]+\. [0-9]+$" | tail -1) && \
82+ pyenv install $pyenvLatestStable && \
83+ pyenv global $pyenvLatestStable && \
84+ pip install --upgrade pip
85+
7586# Install Azure Modules for Powershell - This can take a while, so setting as final step to shorten potential rebuilds
7687RUN pwsh -Command Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted && \
7788 pwsh -Command Install-Module -Name Az -Force -AllowClobber -Scope AllUsers -Repository PSGallery && \
@@ -90,23 +101,18 @@ RUN chmod +x /home/${NORMAL_USER}/Run-AzTerraform.ps1 && \
90101USER ${NORMAL_USER}
91102WORKDIR /home/${NORMAL_USER}
92103
104+ RUN tenv tf install latest --verbose && \
105+ tenv tf use latest --verbose
106+
93107RUN echo -en "\n " | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
94108 echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/${NORMAL_USER}/.bashrc && \
95109 eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
96110 brew install gcc && \
97111 brew install pipx && \
98112 brew install azure-cli && \
99- brew install tenv && \
100- brew install pyenv
113+ brew install tenv
101114
102115RUN tenv tf install latest --verbose && \
103- tenv tf use latest --verbose
104-
105-
106- RUN eval "$(pyenv init --path)" && \
107- pyenvLatestStable=$(pyenv install --list | grep -v - | grep -E "^\s *[0-9]+\. [0-9]+\. [0-9]+$" | tail -1) && \
108- pyenv install $pyenvLatestStable && \
109- pyenv global $pyenvLatestStable && \
110- pip install --upgrade pip
116+ tenv tf use latest --verbose
111117
112118SHELL ["pwsh" , "-Command" ]
0 commit comments