zenith/docker_files/dockerpkg

65 lines
2.3 KiB
Text
Raw Permalink Normal View History

#!/bin/bash
ZVERSION="0.6.0.0"
echo "Docker image package generator"
echo
if ! systemctl is-active --quiet docker ; then
echo "Docker is not active/installed, "
echo "Please activate docker befor proceed!!."
echo
exit
fi
echo "Updating docker binary files ...."
echo
echo "... copying zenith to ./bin folder"
cp "../dist-newstyle/build/x86_64-linux/ghc-9.6.5/zenith-"$ZVERSION"/build/zenith/zenith" "bin/"
echo "... copying assets folder to ./cfg folder"
if [ -d ./cfg/assets ]; then
rm -rf ./cfg/assets
fi
cp -r "../assets" "cfg/"
echo "... copying librustzcash_wrapper.so to ./lib folder"
cp "../zcash-haskell/librustzcash-wrapper/target/x86_64-unknown-linux-gnu/debug/librustzcash_wrapper.so" "lib/"
echo
read -r -p "Do you want to create the docker image? [Y/n] " response
case "$response" in
[yY])
if docker image ls | grep -q "zenith-docker" ; then
echo "... removing previous docker image"
docker rmi -f "zenith-docker:"$ZVERSION
fi
echo "... creating zenith-docker:"$ZVERSION" image"
docker build -t "zenith-docker:"$ZVERSION .
echo "... docker image zenith-docker:"$ZVERSION" created."
echo "... exporting zenith-docker:"$ZVERSION" as .tar file"
docker save -o zenith-docker_$ZVERSION.tar zenith-docker:$ZVERSION
echo "... zenith-docker:"$ZVERSION" image ready."
echo "... creating distribution package file "
if [ -d zenith-docker_$ZVERSION ]; then
rm -rf zenith-docker_$ZVERSION
fi
echo "... creating distribution folder "
mkdir zenith-docker_$ZVERSION
echo "... copying setup_docker script"
chmod +x setup_docker
cp setup_docker zenith-docker_$ZVERSION/
chmod -x setup_docker
echo "... copying cfg folder"
cp -r cfg zenith-docker_$ZVERSION/
echo "... moving docker image to distribution folder"
mv zenith-docker_$ZVERSION.tar zenith-docker_$ZVERSION/
if [ -f zenith-docker_$ZVERSION.7z ]; then
rm zenith-docker_$ZVERSION.7z
fi
echo "... creating distrigution package zenith-docker_$ZVERSION.7z "
7z a zenith-docker_$ZVERSION.7z zenith-docker_$ZVERSION
echo "... distribution file created. (zenith-docker_$ZVERSION.tar.gz)"
;;
*)
echo "... docker image not created."
;;
esac
echo
echo "Done "
echo