Skip to content

Commit e45fd49

Browse files
authored
Merge pull request #34 from jonashackt/feat-33/migrate-to-github-actions
Migrate to GitHub actions & Upgrade to 0.8.3, Spring Boot 2.4.x Release, GraalVM 20.3.x & it's new GitHub Packages Docker Image
2 parents e0d8c8c + 70ca7fc commit e45fd49

File tree

6 files changed

+204
-81
lines changed

6 files changed

+204
-81
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 }}

.travis.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

Dockerfile

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

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

2121
RUN native-image --version
2222

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

2525

2626
# 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
@@ -29,7 +29,7 @@ FROM oraclelinux:7-slim
2929
MAINTAINER Jonas Hecht
3030

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

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

0 commit comments

Comments
 (0)