From 3e239118f93e12b38d1ce7df39f0e7fdecfa3f83 Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Thu, 7 Mar 2024 14:47:12 +0100 Subject: [PATCH] fix --- build-images.sh | 30 ++++++++++++++++++++++-- webssh/build-images.sh | 53 ------------------------------------------ 2 files changed, 28 insertions(+), 55 deletions(-) delete mode 100755 webssh/build-images.sh diff --git a/build-images.sh b/build-images.sh index a221e00..ad9ee2e 100755 --- a/build-images.sh +++ b/build-images.sh @@ -17,9 +17,35 @@ grafana_version=10.3.3 webssh_version=1.6.2 echo "Build webssh container" # from https://github.com/huashengdun/webssh -pushd webssh -./build-images.sh "${webssh_version}" +# Create a new empty container for webssh +echo "Build webssh container" # from https://github.com/huashengdun/webssh +mkdir -p webssh_tmp/build +pushd webssh_tmp +wget https://github.com/huashengdun/webssh/archive/refs/tags/v${webssh_version}.tar.gz -O webssh.tar.gz +tar xvzf webssh.tar.gz -C build --strip-components=1 +pushd build +webssh=$(buildah from docker.io/python:3-alpine) +buildah add "${webssh}" . /code +buildah run \ + --workingdir '/code' \ + ${webssh} \ + sh -c "apk add --no-cache libc-dev libffi-dev gcc && \ + pip install -r requirements.txt --no-cache-dir && \ + apk del gcc libc-dev libffi-dev && \ + addgroup webssh && \ + adduser -Ss /bin/false -g webssh webssh && \ + chown -R webssh:webssh /code + " +popd popd +rm -rf webssh_tmp +# Commit the image +buildah add "${webssh}" webssh/entrypoint.sh /entrypoint.sh +buildah config --workingdir '/code' --entrypoint='["/entrypoint.sh"]' --cmd='["python", "run.py"]' "${webssh}" +buildah commit "${webssh}" "${repobase}/webssh" + +# Append the image URL to the images array +images+=("${repobase}/webssh") # Create a new empty container image container=$(buildah from scratch) diff --git a/webssh/build-images.sh b/webssh/build-images.sh deleted file mode 100755 index 98d389c..0000000 --- a/webssh/build-images.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# Terminate on error -set -e - -# Prepare variables for later use -images=() -# The image will be pushed to GitHub container registry -repobase="${REPOBASE:-ghcr.io/nethserver}" -webssh_version=$1 - -# Create a new empty container for webssh -echo "Build webssh container" # from https://github.com/huashengdun/webssh -mkdir -p webssh_tmp/build -pushd webssh_tmp -wget https://github.com/huashengdun/webssh/archive/refs/tags/v${webssh_version}.tar.gz -O webssh.tar.gz -tar xvzf webssh.tar.gz -C build --strip-components=1 -pushd build -webssh=$(buildah from docker.io/python:3-alpine) -buildah add "${webssh}" . /code -buildah run \ - --workingdir '/code' \ - ${webssh} \ - sh -c "apk add --no-cache libc-dev libffi-dev gcc && \ - pip install -r requirements.txt --no-cache-dir && \ - apk del gcc libc-dev libffi-dev && \ - addgroup webssh && \ - adduser -Ss /bin/false -g webssh webssh && \ - chown -R webssh:webssh /code - " -popd -popd -rm -rf webssh_tmp -# Commit the image -buildah add "${webssh}" entrypoint.sh /entrypoint.sh -buildah config --workingdir '/code' --entrypoint='["/entrypoint.sh"]' --cmd='["python", "run.py"]' "${webssh}" -buildah commit "${webssh}" "${repobase}/webssh" - -# Append the image URL to the images array -images+=("${repobase}/webssh") - -# -# Setup CI when pushing to Github. -# Warning! docker::// protocol expects lowercase letters (,,) -if [[ -n "${CI}" ]]; then - # Set output value for Github Actions - printf "::set-output name=images::%s\n" "${images[*],,}" -else - # Just print info for manual push - printf "Publish the images with:\n\n" - for image in "${images[@],,}"; do printf " buildah push %s docker://%s:%s\n" "${image}" "${image}" "${IMAGETAG:-latest}" ; done - printf "\n" -fi