Prebuild commit - build graalvm bin in phase 1, use bin to stage app in phase 2

This commit is contained in:
Mirco 2024-06-20 22:05:15 +02:00
parent b2e3ef9ade
commit 1b598653d0
7 changed files with 1997 additions and 2069 deletions

View file

@ -9,7 +9,7 @@ plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'com.vaadin' version '24.4.3'
id 'com.vaadin' version '24.3.3'
id 'org.graalvm.buildtools.native' version '0.10.2'
}
@ -21,7 +21,7 @@ repositories {
}
ext {
set('vaadinVersion', '24.4.3')
set('vaadinVersion', '24.3.3')
}
configurations {
@ -60,9 +60,10 @@ java {
graalvmNative {
binaries {
main {
mainClass = 'com.ModeratoElection.MEApplication'
mainClass = 'com.ModeratorElection.MEApplication'
fallback = false
imageName.set('ModeratorElection')
//javaLauncher @JavaExec :: Configures the java executable to be used to run the tests.
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
//vendor.set(JvmVendorSpec.GRAAL_VM)
@ -73,3 +74,15 @@ graalvmNative {
toolchainDetection = false
}
//tasks.withType(JavaCompile) {
// options.compilerArgs += ['-Xlint:deprecation','-Xlint:unchecked']
//}
task runApp(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'package.Main'
// arguments to pass to the application
args 'membernames'
}

View file

@ -1,4 +1,7 @@
### ToDo
```
useable vaadin version 24.3.3 !latest v24.4.3
```
```
HowTo BUILD jar?
@ -10,6 +13,20 @@ java -jar build/libs/ModeratorElection.jar -> localhost:6333 "White Label..."-Er
..in ide dev: ./gradlew clean vaadinPrepareFrontend
```
```
-x processTestAot exclude
https://docs.spring.io/spring-boot/gradle-plugin/aot.html
Processing Tests
The AOT engine can be applied to JUnit 5 tests that use Springs Test Context Framework.
Suitable tests are processed by the 'processTestAot' task to generate
'ApplicationContextInitializer' code. As with application AOT processing, the 'BeanFactory'
is fully prepared at build-time. As with 'processAot', the 'processTestAot' task is 'JavaExec'
subclass and can be configured as needed to influence this processing.
The 'nativeTest' task of the GraalVM Native Image plugin is automatically configured to
use the output of the 'processAot' and 'processTestAot' tasks.
```
```
For production:
* install.sh
@ -22,6 +39,8 @@ For production:
```
build graalvm binary
./gradlew nativeCompile failed, need for some improvements!
./gradlew nativeCompile -Dvaadin.productionMode=true
```
```

View file

@ -3,7 +3,7 @@
This file is auto-generated by Vaadin.
-->
<html lang="en">
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
#Build Stage
FROM ubuntu:noble-20240605
FROM ubuntu:noble-20240605 as build-env
ADD resources /tmp
RUN /tmp/install.sh
@ -7,8 +7,20 @@ ENV LANG=en_US.UTF-8 \
JAVA_HOME=/usr/lib/jvm/graalvm
# Run stage
FROM eclipse-temurin:17.0.11_9-jdk
#FROM eclipse-temurin:17.0.11_9-jdk
FROM ubuntu:noble-20240605
RUN apt-get update
RUN apt-get -qqy upgrade
EXPOSE 8080
CMD ["mkdir /usr/local/src/ModeratorElection"]
WORKDIR /usr/local/src/ModeratorElection/
EXPOSE 80 8080
#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 .
#ENV MEMBERNAMES
CMD ["java -jar ModeratorElection.jar", "curl -X GET http://localhost:8080"]
#ENTRYPOINT ["java", "-jar", "ModeratorElection.jar"]
ENTRYPOINT ["ModeratorElection"]

View file

@ -6,7 +6,8 @@ function main()
{
upgradeSystem
#openjdk-17-jdk-headless, no need, we are installing graalvm
apt-get -qqy install git curl unzip
#unzpip only necessary for gradle installation within main()
apt-get -qqy install git curl
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
@ -44,13 +45,7 @@ function main()
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
#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/
#install -m 0700 /tmp/restic-snapshots.sh /usr/local/bin/
#cleanupDocker
cleanupDocker
} #> /dev/null
function checksum() {
@ -63,9 +58,12 @@ 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
npm install -g npm@latest
npm audit fix --force
#npm ci --omit=dev
#./gradlew build
cd /usr/local/src/ModeratorElection/
#build jar
./gradlew clean build -Pvaadin.productionMode -x processTestAot
#build graalvm binary
./gradlew nativeCompile

3728
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,84 +4,180 @@
"type": "module",
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.4.0",
"@vaadin/a11y-base": "24.3.3",
"@vaadin/accordion": "24.3.3",
"@vaadin/app-layout": "24.3.3",
"@vaadin/avatar": "24.3.3",
"@vaadin/avatar-group": "24.3.3",
"@vaadin/bundles": "24.3.3",
"@vaadin/button": "24.3.3",
"@vaadin/checkbox": "24.3.3",
"@vaadin/checkbox-group": "24.3.3",
"@vaadin/combo-box": "24.3.3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/polymer-legacy-adapter": "24.4.0",
"@vaadin/react-components": "24.4.0",
"@vaadin/component-base": "24.3.3",
"@vaadin/confirm-dialog": "24.3.3",
"@vaadin/context-menu": "24.3.3",
"@vaadin/custom-field": "24.3.3",
"@vaadin/date-picker": "24.3.3",
"@vaadin/date-time-picker": "24.3.3",
"@vaadin/details": "24.3.3",
"@vaadin/dialog": "24.3.3",
"@vaadin/email-field": "24.3.3",
"@vaadin/field-base": "24.3.3",
"@vaadin/field-highlighter": "24.3.3",
"@vaadin/form-layout": "24.3.3",
"@vaadin/grid": "24.3.3",
"@vaadin/horizontal-layout": "24.3.3",
"@vaadin/icon": "24.3.3",
"@vaadin/icons": "24.3.3",
"@vaadin/input-container": "24.3.3",
"@vaadin/integer-field": "24.3.3",
"@vaadin/item": "24.3.3",
"@vaadin/list-box": "24.3.3",
"@vaadin/lit-renderer": "24.3.3",
"@vaadin/login": "24.3.3",
"@vaadin/menu-bar": "24.3.3",
"@vaadin/message-input": "24.3.3",
"@vaadin/message-list": "24.3.3",
"@vaadin/multi-select-combo-box": "24.3.3",
"@vaadin/notification": "24.3.3",
"@vaadin/number-field": "24.3.3",
"@vaadin/overlay": "24.3.3",
"@vaadin/password-field": "24.3.3",
"@vaadin/polymer-legacy-adapter": "24.3.3",
"@vaadin/progress-bar": "24.3.3",
"@vaadin/radio-group": "24.3.3",
"@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.0",
"@vaadin/vaadin-material-styles": "24.4.0",
"@vaadin/vaadin-themable-mixin": "24.4.0",
"@vaadin/scroller": "24.3.3",
"@vaadin/select": "24.3.3",
"@vaadin/side-nav": "24.3.3",
"@vaadin/split-layout": "24.3.3",
"@vaadin/tabs": "24.3.3",
"@vaadin/tabsheet": "24.3.3",
"@vaadin/text-area": "24.3.3",
"@vaadin/text-field": "24.3.3",
"@vaadin/time-picker": "24.3.3",
"@vaadin/tooltip": "24.3.3",
"@vaadin/upload": "24.3.3",
"@vaadin/vaadin-development-mode-detector": "2.0.6",
"@vaadin/vaadin-lumo-styles": "24.3.3",
"@vaadin/vaadin-material-styles": "24.3.3",
"@vaadin/vaadin-themable-mixin": "24.3.3",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"@vaadin/vertical-layout": "24.3.3",
"@vaadin/virtual-list": "24.3.3",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
"lit": "3.1.0"
},
"devDependencies": {
"@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"@rollup/plugin-replace": "5.0.4",
"@rollup/pluginutils": "5.0.5",
"@vitejs/plugin-react": "4.2.0",
"@vitejs/plugin-react-swc": "3.5.0",
"async": "3.2.4",
"glob": "10.3.3",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"rollup-plugin-visualizer": "5.9.2",
"strip-css-comments": "5.0.0",
"transform-ast": "2.4.4",
"typescript": "5.4.5",
"vite": "5.3.1",
"vite-plugin-checker": "0.6.4",
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
"typescript": "5.3.3",
"vite": "5.0.6",
"vite-plugin-checker": "0.6.2",
"workbox-build": "7.0.0",
"workbox-core": "7.0.0",
"workbox-precaching": "7.0.0"
},
"vaadin": {
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.4.0",
"@vaadin/a11y-base": "24.3.3",
"@vaadin/accordion": "24.3.3",
"@vaadin/app-layout": "24.3.3",
"@vaadin/avatar": "24.3.3",
"@vaadin/avatar-group": "24.3.3",
"@vaadin/bundles": "24.3.3",
"@vaadin/button": "24.3.3",
"@vaadin/checkbox": "24.3.3",
"@vaadin/checkbox-group": "24.3.3",
"@vaadin/combo-box": "24.3.3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/polymer-legacy-adapter": "24.4.0",
"@vaadin/react-components": "24.4.0",
"@vaadin/component-base": "24.3.3",
"@vaadin/confirm-dialog": "24.3.3",
"@vaadin/context-menu": "24.3.3",
"@vaadin/custom-field": "24.3.3",
"@vaadin/date-picker": "24.3.3",
"@vaadin/date-time-picker": "24.3.3",
"@vaadin/details": "24.3.3",
"@vaadin/dialog": "24.3.3",
"@vaadin/email-field": "24.3.3",
"@vaadin/field-base": "24.3.3",
"@vaadin/field-highlighter": "24.3.3",
"@vaadin/form-layout": "24.3.3",
"@vaadin/grid": "24.3.3",
"@vaadin/horizontal-layout": "24.3.3",
"@vaadin/icon": "24.3.3",
"@vaadin/icons": "24.3.3",
"@vaadin/input-container": "24.3.3",
"@vaadin/integer-field": "24.3.3",
"@vaadin/item": "24.3.3",
"@vaadin/list-box": "24.3.3",
"@vaadin/lit-renderer": "24.3.3",
"@vaadin/login": "24.3.3",
"@vaadin/menu-bar": "24.3.3",
"@vaadin/message-input": "24.3.3",
"@vaadin/message-list": "24.3.3",
"@vaadin/multi-select-combo-box": "24.3.3",
"@vaadin/notification": "24.3.3",
"@vaadin/number-field": "24.3.3",
"@vaadin/overlay": "24.3.3",
"@vaadin/password-field": "24.3.3",
"@vaadin/polymer-legacy-adapter": "24.3.3",
"@vaadin/progress-bar": "24.3.3",
"@vaadin/radio-group": "24.3.3",
"@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.0",
"@vaadin/vaadin-material-styles": "24.4.0",
"@vaadin/vaadin-themable-mixin": "24.4.0",
"@vaadin/scroller": "24.3.3",
"@vaadin/select": "24.3.3",
"@vaadin/side-nav": "24.3.3",
"@vaadin/split-layout": "24.3.3",
"@vaadin/tabs": "24.3.3",
"@vaadin/tabsheet": "24.3.3",
"@vaadin/text-area": "24.3.3",
"@vaadin/text-field": "24.3.3",
"@vaadin/time-picker": "24.3.3",
"@vaadin/tooltip": "24.3.3",
"@vaadin/upload": "24.3.3",
"@vaadin/vaadin-development-mode-detector": "2.0.6",
"@vaadin/vaadin-lumo-styles": "24.3.3",
"@vaadin/vaadin-material-styles": "24.3.3",
"@vaadin/vaadin-themable-mixin": "24.3.3",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"@vaadin/vertical-layout": "24.3.3",
"@vaadin/virtual-list": "24.3.3",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
"lit": "3.1.0"
},
"devDependencies": {
"@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"@rollup/plugin-replace": "5.0.4",
"@rollup/pluginutils": "5.0.5",
"@vitejs/plugin-react": "4.2.0",
"@vitejs/plugin-react-swc": "3.5.0",
"async": "3.2.4",
"glob": "10.3.3",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"rollup-plugin-visualizer": "5.9.2",
"strip-css-comments": "5.0.0",
"transform-ast": "2.4.4",
"typescript": "5.4.5",
"vite": "5.3.1",
"vite-plugin-checker": "0.6.4",
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
"typescript": "5.3.3",
"vite": "5.0.6",
"vite-plugin-checker": "0.6.2",
"workbox-build": "7.0.0",
"workbox-core": "7.0.0",
"workbox-precaching": "7.0.0"
},
"hash": "a138b9347a25dacd61eb23a186fb55a3bff3993609bd58738beb6651e7993e01"
"hash": "ac7fbcf666df2ebff56ca009354fc8d94a61c61e3e86a9617779b03878adc88b"
},
"overrides": {
"@vaadin/bundles": "$@vaadin/bundles",
@ -97,9 +193,59 @@
"@polymer/polymer": "$@polymer/polymer",
"@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin",
"date-fns": "$date-fns",
"@vaadin/react-components": "$@vaadin/react-components",
"react-dom": "$react-dom",
"react-router-dom": "$react-router-dom",
"react": "$react"
"@vaadin/a11y-base": "$@vaadin/a11y-base",
"@vaadin/accordion": "$@vaadin/accordion",
"@vaadin/app-layout": "$@vaadin/app-layout",
"@vaadin/avatar": "$@vaadin/avatar",
"@vaadin/avatar-group": "$@vaadin/avatar-group",
"@vaadin/button": "$@vaadin/button",
"@vaadin/checkbox": "$@vaadin/checkbox",
"@vaadin/checkbox-group": "$@vaadin/checkbox-group",
"@vaadin/combo-box": "$@vaadin/combo-box",
"@vaadin/component-base": "$@vaadin/component-base",
"@vaadin/confirm-dialog": "$@vaadin/confirm-dialog",
"@vaadin/context-menu": "$@vaadin/context-menu",
"@vaadin/custom-field": "$@vaadin/custom-field",
"@vaadin/date-picker": "$@vaadin/date-picker",
"@vaadin/date-time-picker": "$@vaadin/date-time-picker",
"@vaadin/details": "$@vaadin/details",
"@vaadin/dialog": "$@vaadin/dialog",
"@vaadin/email-field": "$@vaadin/email-field",
"@vaadin/field-base": "$@vaadin/field-base",
"@vaadin/field-highlighter": "$@vaadin/field-highlighter",
"@vaadin/form-layout": "$@vaadin/form-layout",
"@vaadin/grid": "$@vaadin/grid",
"@vaadin/horizontal-layout": "$@vaadin/horizontal-layout",
"@vaadin/icon": "$@vaadin/icon",
"@vaadin/icons": "$@vaadin/icons",
"@vaadin/input-container": "$@vaadin/input-container",
"@vaadin/integer-field": "$@vaadin/integer-field",
"@vaadin/item": "$@vaadin/item",
"@vaadin/list-box": "$@vaadin/list-box",
"@vaadin/lit-renderer": "$@vaadin/lit-renderer",
"@vaadin/login": "$@vaadin/login",
"@vaadin/menu-bar": "$@vaadin/menu-bar",
"@vaadin/message-input": "$@vaadin/message-input",
"@vaadin/message-list": "$@vaadin/message-list",
"@vaadin/multi-select-combo-box": "$@vaadin/multi-select-combo-box",
"@vaadin/notification": "$@vaadin/notification",
"@vaadin/number-field": "$@vaadin/number-field",
"@vaadin/overlay": "$@vaadin/overlay",
"@vaadin/password-field": "$@vaadin/password-field",
"@vaadin/progress-bar": "$@vaadin/progress-bar",
"@vaadin/radio-group": "$@vaadin/radio-group",
"@vaadin/scroller": "$@vaadin/scroller",
"@vaadin/select": "$@vaadin/select",
"@vaadin/side-nav": "$@vaadin/side-nav",
"@vaadin/split-layout": "$@vaadin/split-layout",
"@vaadin/tabs": "$@vaadin/tabs",
"@vaadin/tabsheet": "$@vaadin/tabsheet",
"@vaadin/text-area": "$@vaadin/text-area",
"@vaadin/text-field": "$@vaadin/text-field",
"@vaadin/time-picker": "$@vaadin/time-picker",
"@vaadin/tooltip": "$@vaadin/tooltip",
"@vaadin/upload": "$@vaadin/upload",
"@vaadin/vertical-layout": "$@vaadin/vertical-layout",
"@vaadin/virtual-list": "$@vaadin/virtual-list"
}
}