2024-06-13 20:20:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -exo pipefail
|
|
|
|
|
|
|
|
function main()
|
|
|
|
{
|
|
|
|
upgradeSystem
|
2024-06-14 15:41:12 +00:00
|
|
|
#openjdk-17-jdk-headless, no need, we are installing graalvm
|
2024-06-20 20:05:15 +00:00
|
|
|
#unzpip only necessary for gradle installation within main()
|
|
|
|
apt-get -qqy install git curl
|
2024-06-13 20:20:25 +00:00
|
|
|
mkdir /usr/local/src/ModeratorElection
|
2024-06-14 15:41:12 +00:00
|
|
|
#change to main branch for production
|
|
|
|
git clone --single-branch --branch MEapp-development https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
|
2024-06-13 20:20:25 +00:00
|
|
|
|
|
|
|
#download gradle
|
|
|
|
#gradle_version="8.4"
|
|
|
|
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip
|
|
|
|
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip.sha256 https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip.sha256
|
|
|
|
|
2024-06-14 15:41:12 +00:00
|
|
|
#download graalvm
|
|
|
|
#oracle graalvm-jdk, v17.0.11, 2024-06-14
|
|
|
|
graalvm_JDK_version="17"
|
|
|
|
curl -SsLo /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz https://download.oracle.com/graalvm/${graalvm_JDK_version}/latest/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
|
|
|
|
curl -SsLo /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256 https://download.oracle.com/graalvm/${graalvm_JDK_version}/latest/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
|
|
|
|
|
|
|
#graalvm-community-jdk, v17.0.8, 2023-07-25
|
|
|
|
#graalvm_jdk_version="17.0.8"
|
|
|
|
#curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz
|
|
|
|
#curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256
|
|
|
|
|
2024-06-20 13:09:08 +00:00
|
|
|
#checksum graalvm
|
2024-06-14 15:41:12 +00:00
|
|
|
checksum
|
2024-06-13 20:20:25 +00:00
|
|
|
|
2024-06-20 13:09:08 +00:00
|
|
|
#install graalvm
|
|
|
|
mkdir /usr/lib/jvm/
|
|
|
|
tar -C /usr/lib/jvm/ -xzf /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
|
2024-06-14 15:41:12 +00:00
|
|
|
dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
|
|
|
|
ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
|
|
|
|
ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
|
2024-06-20 13:09:08 +00:00
|
|
|
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 0
|
2024-06-13 20:20:25 +00:00
|
|
|
|
2024-06-20 13:09:08 +00:00
|
|
|
echo "export PATH=$PATH:/usr/lib/jvm/$dirname_graalvm/lib/svm/bin"|tee -a /root/.bashrc
|
|
|
|
#possibility to install js, node.js,... to graalvm using "gu"
|
|
|
|
#"gu available" shows available components, native-image is one part of it
|
|
|
|
echo "export PATH=$PATH:/usr/lib/jvm/graalvm-jdk-17.0.11+7.1/lib/installer/bin/gu"|tee -a /root/.bashrc
|
|
|
|
/usr/lib/jvm/$dirname_graalvm/lib/svm/bin/native-image --version
|
2024-06-14 15:41:12 +00:00
|
|
|
|
2024-06-20 20:05:15 +00:00
|
|
|
cleanupDocker
|
2024-06-13 20:20:25 +00:00
|
|
|
} #> /dev/null
|
|
|
|
|
|
|
|
function checksum() {
|
2024-06-14 15:41:12 +00:00
|
|
|
#graalvm
|
|
|
|
echo " /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz"|tee -a /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
2024-06-20 13:09:08 +00:00
|
|
|
sha256sum -c --status /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
2024-06-13 20:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
source /tmp/install_functions_debian.sh
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
|
|
|
|
|
2024-06-14 15:41:12 +00:00
|
|
|
#cd /usr/local/src/ModeratorElection
|
2024-06-20 20:05:15 +00:00
|
|
|
npm install -g npm@latest
|
|
|
|
npm audit fix --force
|
2024-06-13 20:20:25 +00:00
|
|
|
#npm ci --omit=dev
|
|
|
|
#./gradlew build
|
2024-06-20 13:09:08 +00:00
|
|
|
cd /usr/local/src/ModeratorElection/
|
2024-06-20 20:05:15 +00:00
|
|
|
#build jar
|
2024-06-20 13:09:08 +00:00
|
|
|
./gradlew clean build -Pvaadin.productionMode -x processTestAot
|
2024-06-20 20:05:15 +00:00
|
|
|
#build graalvm binary
|
|
|
|
./gradlew nativeCompile
|