From 9f8d4331062d32cb0c41dd2c9c834eb45b84dee8 Mon Sep 17 00:00:00 2001 From: Mirco Date: Fri, 21 Jun 2024 00:27:52 +0200 Subject: [PATCH] binary compilation in image successfully --- build.gradle | 2 ++ doc/dev_notes.md | 4 ++++ image/Dockerfile | 12 +++++++----- image/resources/install.sh | 16 ++++++++-------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index a442ddf..ea3bb0a 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,8 @@ plugins { id 'com.vaadin' version '24.3.3' id 'org.graalvm.buildtools.native' version '0.10.2' } +group = 'com.ModeratorElection' +version = '0.0.1-SNAPSHOT' repositories { mavenCentral() diff --git a/doc/dev_notes.md b/doc/dev_notes.md index d5b3df3..8d74052 100644 --- a/doc/dev_notes.md +++ b/doc/dev_notes.md @@ -41,6 +41,10 @@ build graalvm binary ./gradlew nativeCompile failed, need for some improvements! ./gradlew nativeCompile -Dvaadin.productionMode=true +``` +``` +gu available +https://docs.oracle.com/en/graalvm/enterprise/21/docs/reference-manual/graalvm-updater/#component-installation ``` ``` diff --git a/image/Dockerfile b/image/Dockerfile index 99f4656..fb20026 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,5 +1,5 @@ #Build Stage -FROM ubuntu:noble-20240605 as build-env +FROM node:22-bookworm-slim as build-env ADD resources /tmp RUN /tmp/install.sh @@ -16,11 +16,13 @@ RUN apt-get -qqy upgrade EXPOSE 8080 CMD ["mkdir /usr/local/src/ModeratorElection"] WORKDIR /usr/local/src/ModeratorElection/ -#copy jar -#COPY --from=build-env /usr/local/src/ModeratorElection/build/libs/ModeratorElection.jar . -#copy graalvm binary -COPY --chmod=0700 --from=build-env /usr/local/src/ModeratorElection/build/native/ModeratorElection . +#*SNAPSHOT should be part of the name, asterisk for continueing versionnumber +#copy jar +#COPY --from=build-env /usr/local/src/ModeratorElection/build/libs/ModeratorElection.jar ./ModeratorElection.jar +#copy graalvm binary +COPY --from=build-env /usr/local/src/ModeratorElection/build/native/nativeCompile/ModeratorElection . +CMD ["chmod +x ModerationElection"] #ENV MEMBERNAMES #ENTRYPOINT ["java", "-jar", "ModeratorElection.jar"] ENTRYPOINT ["ModeratorElection"] \ No newline at end of file diff --git a/image/resources/install.sh b/image/resources/install.sh index 01375ea..3569d96 100755 --- a/image/resources/install.sh +++ b/image/resources/install.sh @@ -7,7 +7,7 @@ function main() upgradeSystem #openjdk-17-jdk-headless, no need, we are installing graalvm #unzpip only necessary for gradle installation within main() - apt-get -qqy install git curl + apt-get -qqy install git curl build-essential libz-dev zlib1g-dev 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 @@ -46,6 +46,7 @@ function main() /usr/lib/jvm/$dirname_graalvm/lib/svm/bin/native-image --version cleanupDocker + } #> /dev/null function checksum() { @@ -57,13 +58,12 @@ function checksum() { source /tmp/install_functions_debian.sh DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main -#cd /usr/local/src/ModeratorElection -npm install -g npm@latest -npm audit fix --force -#npm ci --omit=dev -#./gradlew build cd /usr/local/src/ModeratorElection/ +#npm install -g npm@latest +#npm audit fix +#npm ci --omit=dev + #build jar -./gradlew clean build -Pvaadin.productionMode -x processTestAot +#./gradlew clean build -Pvaadin.productionMode -x processTestAot #build graalvm binary -./gradlew nativeCompile +./gradlew nativeCompile -Dvaadin.productionMode=true