From 8e8a349733501319664c6accb9602aba84886a96 Mon Sep 17 00:00:00 2001 From: Julien Caillon Date: Sat, 1 Feb 2025 13:04:46 +0100 Subject: [PATCH] :green_heart: bash5 tests --- .github/workflows/self-test-bash5.yaml | 6 +- .../self-install/docker-bash5-only/Dockerfile | 52 ++++++++++++++ .../self-install/docker-valet-test/Dockerfile | 72 ++++++++++--------- 3 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 tests.d/self-install/docker-bash5-only/Dockerfile diff --git a/.github/workflows/self-test-bash5.yaml b/.github/workflows/self-test-bash5.yaml index 18a703e..ee2fe1a 100644 --- a/.github/workflows/self-test-bash5.yaml +++ b/.github/workflows/self-test-bash5.yaml @@ -15,7 +15,6 @@ jobs: # This workflow contains a single job called "build" self-test-bash5: runs-on: ubuntu-latest - container: noyacode/minideb-bash5.0 steps: - name: Checkout uses: actions/checkout@v4 @@ -29,6 +28,7 @@ jobs: VALET_CONFIG_ENABLE_COLORS: true VALET_CONFIG_DISABLE_PROGRESS: true run: | - bash --version chmod +x valet - ./valet self test -C + docker run --rm -v $PWD:/app -w /app noyacode/minideb-bash5.0 \ + ./valet self test -C + diff --git a/tests.d/self-install/docker-bash5-only/Dockerfile b/tests.d/self-install/docker-bash5-only/Dockerfile new file mode 100644 index 0000000..2c9ff80 --- /dev/null +++ b/tests.d/self-install/docker-bash5-only/Dockerfile @@ -0,0 +1,52 @@ +# ✅ build bash 5.0 +FROM bitnami/minideb:bookworm as bash5-builder + +SHELL ["/bin/sh", "-o", "errexit", "-o", "nounset", "-x", "-c"] + +ARG STANDARD_PACKAGES="build-essential wget" + +RUN \ + install_packages ${STANDARD_PACKAGES} ; \ + cd /tmp; \ + wget http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz; \ + tar xf bash-5.0.tar.gz; \ + cd bash-5.0; \ + ./configure; \ + make; \ + make install; + +FROM bitnami/minideb:bookworm + +SHELL ["/bin/sh", "-o", "errexit", "-o", "nounset", "-x", "-c"] + +ARG STANDARD_PACKAGES="locales ca-certificates curl sudo makepasswd uidmap git xonsh fish zsh csh tcsh ksh wget" + +# ✅ copy bash 5.0 +COPY --from=bash5-builder /usr/local /usr/local/ + +# ✅ install packages + set up locale +ARG LOCALE=en_US +ENV LANG=${LOCALE}.UTF-8 +ENV LC_ALL=${LOCALE}.UTF-8 +ENV LANGUAGE=${LOCALE}.UTF-8 +RUN \ + install_packages ${STANDARD_PACKAGES} ; \ + localedef -i ${LOCALE} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LOCALE}.UTF-8; \ + echo "${LOCALE}.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "LANG=${LOCALE}.UTF-8" >> /etc/locale.conf; \ + locale-gen ${LOCALE}.UTF-8; \ + echo 'me' > /tmp/pw; \ + useradd -m -u 1000 -U -p "$(makepasswd --crypt-md5 --clearfrom=/tmp/pw)" me; \ + echo "me ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/me-sudo; \ + chsh -s /bin/bash me; \ + pushd /tmp; \ + curl -fsSL https://github.com/nushell/nushell/releases/download/0.100.0/nu-0.100.0-x86_64-unknown-linux-gnu.tar.gz -o nu.tar.gz; \ + tar -xvf nu.tar.gz; \ + mv nu-0.100.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu; \ + curl -fsSL https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-unknown-linux-gnu.tar.gz -O; \ + tar -xvf delta-0.18.2-x86_64-unknown-linux-gnu.tar.gz; \ + mv delta-0.18.2-x86_64-unknown-linux-gnu/delta /usr/local/bin/delta; \ + popd; \ + rm -rf /tmp/* \ + rm /bin/bash; \ + sudo ln -s /usr/local/bin/bash /bin/bash; \ No newline at end of file diff --git a/tests.d/self-install/docker-valet-test/Dockerfile b/tests.d/self-install/docker-valet-test/Dockerfile index 176582f..5f8ba07 100644 --- a/tests.d/self-install/docker-valet-test/Dockerfile +++ b/tests.d/self-install/docker-valet-test/Dockerfile @@ -1,48 +1,52 @@ -FROM bitnami/minideb:bookworm +# ✅ build bash 5.0 +FROM bitnami/minideb:bookworm as bash5-builder + +SHELL ["/bin/sh", "-o", "errexit", "-o", "nounset", "-x", "-c"] + +ARG STANDARD_PACKAGES="build-essential wget" + +RUN \ + install_packages ${STANDARD_PACKAGES} ; \ + cd /tmp; \ + wget http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz; \ + tar xf bash-5.0.tar.gz; \ + cd bash-5.0; \ + ./configure; \ + make; \ + make install; + +FROM alpine SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c", "-x"] -ARG STANDARD_PACKAGES="locales ca-certificates curl sudo makepasswd uidmap git xonsh fish zsh csh tcsh ksh build-essential wget" +ARG STANDARD_PACKAGES="locales ca-certificates curl sudo makepasswd uidmap git xonsh fish zsh csh tcsh ksh wget" -# ✅ install packages -# ✅ set up locale +# ✅ copy bash 5.0 +COPY --from=bash5-builder /usr/local/bin/bash /usr/local/bin/bash + +# ✅ install packages + set up locale ARG LOCALE=en_US ENV LANG=${LOCALE}.UTF-8 ENV LC_ALL=${LOCALE}.UTF-8 ENV LANGUAGE=${LOCALE}.UTF-8 RUN \ -install_packages ${STANDARD_PACKAGES} ; \ -localedef -i ${LOCALE} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LOCALE}.UTF-8; \ -echo "${LOCALE}.UTF-8 UTF-8" >> /etc/locale.gen; \ -echo "LANG=${LOCALE}.UTF-8" >> /etc/locale.conf; \ -locale-gen ${LOCALE}.UTF-8; \ -echo 'me' > /tmp/pw; \ -useradd -m -u 1000 -U -p "$(makepasswd --crypt-md5 --clearfrom=/tmp/pw)" me; \ -echo "me ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/me-sudo; \ -chsh -s /bin/bash me; \ -curl -fsSL https://github.com/nushell/nushell/releases/download/0.100.0/nu-0.100.0-x86_64-unknown-linux-gnu.tar.gz -o nu.tar.gz; \ -tar -xvf nu.tar.gz; \ -mv nu-0.100.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu; - -# ✅ instal delta -RUN \ + install_packages ${STANDARD_PACKAGES} ; \ + localedef -i ${LOCALE} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LOCALE}.UTF-8; \ + echo "${LOCALE}.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "LANG=${LOCALE}.UTF-8" >> /etc/locale.conf; \ + locale-gen ${LOCALE}.UTF-8; \ + echo 'me' > /tmp/pw; \ + useradd -m -u 1000 -U -p "$(makepasswd --crypt-md5 --clearfrom=/tmp/pw)" me; \ + echo "me ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/me-sudo; \ + chsh -s /bin/bash me; \ pushd /tmp; \ + curl -fsSL https://github.com/nushell/nushell/releases/download/0.100.0/nu-0.100.0-x86_64-unknown-linux-gnu.tar.gz -o nu.tar.gz; \ + tar -xvf nu.tar.gz; \ + mv nu-0.100.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu; \ curl -fsSL https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-unknown-linux-gnu.tar.gz -O; \ tar -xvf delta-0.18.2-x86_64-unknown-linux-gnu.tar.gz; \ mv delta-0.18.2-x86_64-unknown-linux-gnu/delta /usr/local/bin/delta; \ popd; \ - rm -rf /tmp/* - -# now install bash 5.0 -SHELL ["/bin/sh", "-o", "errexit", "-o", "nounset", "-x", "-c"] - -RUN \ -cd /tmp; \ -wget http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz; \ -tar xf bash-5.0.tar.gz; \ -cd bash-5.0; \ -./configure; \ -make; \ -sudo make install; \ -rm /bin/bash; \ -sudo ln -s /usr/local/bin/bash /bin/bash; \ No newline at end of file + rm -rf /tmp/* \ + rm /bin/bash; \ + sudo ln -s /usr/local/bin/bash /bin/bash; \ No newline at end of file