Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
38cfdfd
#33: Add first GitHub Actions workflow for native image compilation o…
jonashackt Feb 22, 2021
7dd5c79
#33: Fix workflow
jonashackt Feb 22, 2021
b73a01c
#33: Install GraalVM and native-image together
jonashackt Feb 22, 2021
e921469
#33: Cache SDKMAN installation and also disable Maven download logs.
jonashackt Feb 22, 2021
a063f1d
#33: Remove TravisCI
jonashackt Feb 22, 2021
db8b8fe
#33: Checking if we have a "not in this container" issue
jonashackt Feb 22, 2021
4ffa24a
#33: Checking if we have a "not in this container" issue - fix
jonashackt Feb 22, 2021
7a3c6d1
#33: Cleanup native-image-compile-on-host job
jonashackt Feb 22, 2021
be983e1
#33: Add building native images with Docker also - incl. Release to H…
jonashackt Feb 22, 2021
680dfc7
#33: Changing GitHub Actions syntax to use GitHub encrypted secrets.
jonashackt Feb 22, 2021
30fd0d0
#21: Since the official GraalVM Docker image was removed from DockerH…
jonashackt Feb 22, 2021
095eb05
#33: Prevent SDKMANs `Do you want java 20.3.1.2.r11-grl to be set as …
jonashackt Feb 22, 2021
369685f
#33: Fixing GHA cache definition to use pom.xml in order to prevent S…
jonashackt Feb 22, 2021
24e6b2b
#21: spring-graalvm-native now produces native-image executables dire…
jonashackt Feb 22, 2021
a6f306a
#33: Removing unmatched `'` in line 13 of the Docker build.
jonashackt Feb 22, 2021
da211bc
#33: No caching atm.
jonashackt Feb 22, 2021
70ca7fc
#21: Using latest 20.3.x native-image-maven-plugin
jonashackt Feb 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/native-image-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: native-image-compile

on: [push]

jobs:
native-image-compile-on-host:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install GraalVM, Maven, Native Image & Run Maven build
run: |
echo 'Install GraalVM with SDKMAN'
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 20.3.1.2.r11-grl

echo 'Check if GraalVM was installed successfully'
java -version

echo 'Install GraalVM Native Image'
gu install native-image

echo 'Check if Native Image was installed properly'
native-image --version

echo 'Install Maven, that uses GraalVM for later builds'
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install maven

echo 'Show Maven using GraalVM JDK'
mvn --version

echo 'Run GraalVM Native Image compilation of Spring Boot App (Maven version instead of ./compile.sh)'
mvn -B clean package -P native --no-transfer-progress

native-image-compile-in-docker:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build Native Image with Docker and Release to Heroku & Docker Hub
run: |
echo 'Login into Heroku Container Registry first, so that we can push our Image later'
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin registry.heroku.com

echo 'Compile Native Image using Docker'
docker build . --tag=registry.heroku.com/spring-boot-graal/web

echo 'Push to Heroku Container Registry'
docker push registry.heroku.com/spring-boot-graal/web

echo 'Release Dockerized Native Spring Boot App on Heroku'
./heroku-release.sh spring-boot-graal

echo 'Push to Docker Hub also, since automatic Builds there dont have anough RAM to do a docker build'
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
docker tag registry.heroku.com/spring-boot-graal/web jonashackt/spring-boot-graalvm:latest
docker push jonashackt/spring-boot-graalvm:latest
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple Dockerfile adding Maven and GraalVM Native Image compiler to the standard
# https://hub.docker.com/r/oracle/graalvm-ce image
FROM oracle/graalvm-ce:20.2.0-java11
# https://github.com/orgs/graalvm/packages/container/package/graalvm-ce image
FROM ghcr.io/graalvm/graalvm-ce:ol7-java11-20.3.1.2

ADD . /build
WORKDIR /build
Expand All @@ -20,7 +20,7 @@ RUN source "$HOME/.sdkman/bin/sdkman-init.sh" && mvn --version

RUN native-image --version

RUN source "$HOME/.sdkman/bin/sdkman-init.sh" && ./compile.sh
RUN source "$HOME/.sdkman/bin/sdkman-init.sh" && mvn -B clean package -P native --no-transfer-progress


# We use a Docker multi-stage build here in order that we only take the compiled native Spring Boot App from the first build container
Expand All @@ -29,7 +29,7 @@ FROM oraclelinux:7-slim
MAINTAINER Jonas Hecht

# Add Spring Boot Native app spring-boot-graal to Container
COPY --from=0 "/build/target/native-image/spring-boot-graal" spring-boot-graal
COPY --from=0 "/build/target/spring-boot-graal" spring-boot-graal

# Fire up our Spring Boot Native app by default
CMD [ "sh", "-c", "./spring-boot-graal -Dserver.port=$PORT" ]
Expand Down
Loading