Skip to content

Commit da13ef7

Browse files
committed
update pipeline
1 parent 4dcddc6 commit da13ef7

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

.github/workflows/build-ubuntu-base-docker.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
working_directory:
1010
type: string
1111
description: What working directory should be passed to the script
12-
default: "github_workspace"
12+
default: "containers/ubuntu"
1313
build_context:
1414
type: string
1515
description: "The context of the build"
@@ -62,7 +62,7 @@ jobs:
6262
6363
.\Run-Docker.ps1 `
6464
-WorkingDirectory $workingDirectory `
65-
-BuildContext ${{ inputs.build_context }} `
65+
-BuildContext ${{ github.workspace }} `
6666
-PushDockerImage ${{ inputs.push_docker_image }} `
6767
-DebugMode ${{ inputs.enable_debug_mode }} `
6868
-DockerImageName ${{ inputs.docker_image_name }} `

containers/rhel/Dockerfile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FROM registry.access.redhat.com/ubi9/ubi:latest
44
LABEL org.opencontainers.image.title=rhel
55
LABEL 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
810
ARG NORMAL_USER=builder
911
ARG DEBIAN_FRONTEND=noninteractive
@@ -16,6 +18,8 @@ ENV TARGETARCH ${TARGETARCH}
1618

1719
# Environment variables for pyenv
1820
ENV 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
2125
ENV 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
7687
RUN 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 && \
90101
USER ${NORMAL_USER}
91102
WORKDIR /home/${NORMAL_USER}
92103

104+
RUN tenv tf install latest --verbose && \
105+
tenv tf use latest --verbose
106+
93107
RUN 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

102115
RUN 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

112118
SHELL ["pwsh", "-Command"]

containers/ubuntu/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ ENV TARGETARCH ${TARGETARCH}
1414

1515
# Environment variables for pyenv
1616
ENV HOME /home/${NORMAL_USER}
17+
ENV PYENV_ROOT /home/${NORMAL_USER}/.pyenv
18+
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
1719

1820
#Set path vars
1921
ENV 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}/.pyenv:/home/${NORMAL_USER}/.pyenv/bin:/home/${NORMAL_USER}/.local:/home/${NORMAL_USER}/.tenv:/home/${NORMAL_USER}/.tenv/bin:/home/${NORMAL_USER}/.pkenv:/home/${NORMAL_USER}/.pkenv/bin:/home/${NORMAL_USER}/.goenv:/home/${NORMAL_USER}/.goenv/bin:/home/${NORMAL_USER}/.jenv:/home/${NORMAL_USER}/.jenv/bin:/home/${NORMAL_USER}/.nvm:/home/${NORMAL_USER}/.rbenv:/home/${NORMAL_USER}/.rbenv/bin:/home/${NORMAL_USER}/.sdkman:/home/${NORMAL_USER}/.sdkman/bin:/home/${NORMAL_USER}/.dotnet:/home/${NORMAL_USER}/.cargo:/home/${NORMAL_USER}/.cargo/bin:/home/${NORMAL_USER}/.phpenv:/home/${NORMAL_USER}/.phpenv/bin:/home/${NORMAL_USER}:/home/${NORMAL_USER}/.pyenv/shims:/home/${NORMAL_USER}/.local/bin"
@@ -65,6 +67,14 @@ RUN useradd -ms /bin/bash ${NORMAL_USER} && \
6567
curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_VERSION}_amd64.deb" && \
6668
sudo dpkg -i cosign_${LATEST_VERSION}_amd64.deb
6769

70+
71+
RUN git clone https://github.com/pyenv/pyenv.git /home/${NORMAL_USER}/.pyenv && \
72+
eval "$(pyenv init --path)" && \
73+
pyenvLatestStable=$(pyenv install --list | grep -v - | grep -E "^\s*[0-9]+\.[0-9]+\.[0-9]+$" | tail -1) && \
74+
pyenv install $pyenvLatestStable && \
75+
pyenv global $pyenvLatestStable && \
76+
pip install --upgrade pip
77+
6878
# Install PowerShell
6979
RUN curl -sSLO https://packages.microsoft.com/config/ubuntu/$(grep -oP '(?<=^DISTRIB_RELEASE=).+' /etc/lsb-release | tr -d '"')/packages-microsoft-prod.deb && \
7080
dpkg -i packages-microsoft-prod.deb && \
@@ -103,7 +113,6 @@ RUN echo -en "\n" | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com
103113
brew install gcc && \
104114
brew install pipx && \
105115
brew install tenv && \
106-
brew install pyenv && \
107116
brew install azure-cli
108117

109118
RUN tenv tf install latest --verbose && \

0 commit comments

Comments
 (0)