From a0691894ac705114e654edf631be9b0b10706769 Mon Sep 17 00:00:00 2001 From: Mirco Date: Thu, 20 Jun 2024 15:09:08 +0200 Subject: [PATCH] Some further docker image steps --- build.gradle | 2 ++ build.py | 2 +- image/Dockerfile | 5 +++-- image/resources/install.sh | 31 +++++++++++++------------------ 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index 613c70c..28957d6 100644 --- a/build.gradle +++ b/build.gradle @@ -60,6 +60,8 @@ java { graalvmNative { binaries { main { + mainClass = 'com.ModeratoElection.MEApplication' + fallback = false imageName.set('ModeratorElection') javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(17)) diff --git a/build.py b/build.py index 5d23205..93244bf 100644 --- a/build.py +++ b/build.py @@ -16,7 +16,7 @@ def initialize(project): input = { "name": name, - "module": "notused", + "module": "vaadin_fullstack", "stage": "notused", "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], diff --git a/image/Dockerfile b/image/Dockerfile index e9e6136..635472c 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,6 +1,7 @@ #Build Stage -FROM node:22.3.0-bookworm-slim +FROM ubuntu:noble-20240605 ADD resources /tmp RUN /tmp/install.sh - +ENV LANG=en_US.UTF-8 \ + JAVA_HOME=/usr/lib/jvm/graalvm diff --git a/image/resources/install.sh b/image/resources/install.sh index fe5615f..4883726 100755 --- a/image/resources/install.sh +++ b/image/resources/install.sh @@ -10,7 +10,6 @@ function main() mkdir /usr/local/src/ModeratorElection #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 - #cp /tmp/MEMBERNAMES /usr/local/src/ModeratorElection #download gradle #gradle_version="8.4" @@ -28,26 +27,24 @@ function main() #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 - #checksum gradle, graalvm + #checksum graalvm checksum - #install gradle - #mkdir /opt/gradle - #unzip -qqd /opt/gradle /tmp/gradle-${gradle_version}-bin.zip - #export PATH=$PATH:/opt/gradle/gradle-${gradle_version}/bin - - #install graalvm -- ToDo: need to be checked, graalvm after installing available as default-jvm? - tar -C /usr/lib/jvm/ -xzf graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz + #install graalvm + mkdir /usr/lib/jvm/ + tar -C /usr/lib/jvm/ -xzf /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz 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 - update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2 + update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 0 + 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 - - #ToDo install by graalvm, put graalvm binary here #install -m 0700 /tmp/entrypoint-start-and-wait.sh / - #install -m 0700 /tmp/init.sh /usr/local/bin/ #install -m 0700 /tmp/backup.sh /usr/local/bin/ #install -m 0700 /tmp/restore.sh /usr/local/bin/ @@ -57,13 +54,9 @@ function main() } #> /dev/null function checksum() { - #gradle - #echo " /tmp/gradle-${gradle_version}-bin.zip"|tee -a /tmp/gradle-${gradle_version}-bin.zip.sha256 - #sha256sum -c --status /tmp/gradle-${gradle_version}-bin.zip.sha256 - #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 - sha256sum -c --status graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256 + sha256sum -c --status /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256 } source /tmp/install_functions_debian.sh @@ -74,3 +67,5 @@ DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main #npm audit fix #npm ci --omit=dev #./gradlew build +cd /usr/local/src/ModeratorElection/ +./gradlew clean build -Pvaadin.productionMode -x processTestAot