1+ name : native-image-compile
2+ 3+ on : [push]
4+ 5+ jobs :
6+ native-image-compile-on-host :
7+ runs-on : ubuntu-latest
8+ 9+ steps :
10+ - uses : actions/checkout@v2
11+ 12+ - name : Install GraalVM, Maven, Native Image & Run Maven build
13+ run : |
14+ echo 'Install GraalVM with SDKMAN'
15+ curl -s "https://get.sdkman.io" | bash
16+ source "$HOME/.sdkman/bin/sdkman-init.sh"
17+ sdk install java 20.3.1.2.r11-grl
18+
19+ echo 'Check if GraalVM was installed successfully'
20+ java -version
21+
22+ echo 'Install GraalVM Native Image'
23+ gu install native-image
24+
25+ echo 'Check if Native Image was installed properly'
26+ native-image --version
27+
28+ echo 'Install Maven, that uses GraalVM for later builds'
29+ source "$HOME/.sdkman/bin/sdkman-init.sh"
30+ sdk install maven
31+
32+ echo 'Show Maven using GraalVM JDK'
33+ mvn --version
34+
35+ echo 'Run GraalVM Native Image compilation of Spring Boot App (Maven version instead of ./compile.sh)'
36+ mvn -B clean package -P native --no-transfer-progress
37+
38+ native-image-compile-in-docker :
39+ runs-on : ubuntu-latest
40+ 41+ steps :
42+ - uses : actions/checkout@v2
43+ 44+ - name : Build Native Image with Docker and Release to Heroku & Docker Hub
45+ run : |
46+ echo 'Login into Heroku Container Registry first, so that we can push our Image later'
47+ echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin registry.heroku.com
48+
49+ echo 'Compile Native Image using Docker'
50+ docker build . --tag=registry.heroku.com/spring-boot-graal/web
51+
52+ echo 'Push to Heroku Container Registry'
53+ docker push registry.heroku.com/spring-boot-graal/web
54+
55+ echo 'Release Dockerized Native Spring Boot App on Heroku'
56+ ./heroku-release.sh spring-boot-graal
57+
58+ echo 'Push to Docker Hub also, since automatic Builds there dont have anough RAM to do a docker build'
59+ echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
60+ docker tag registry.heroku.com/spring-boot-graal/web jonashackt/spring-boot-graalvm:latest
61+ docker push jonashackt/spring-boot-graalvm:latest
62+ env :
63+ DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
0 commit comments