Skip to content

Commit

Permalink
update graalvm files and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Dec 2, 2023
1 parent ea97763 commit 272c993
Show file tree
Hide file tree
Showing 8 changed files with 3,040 additions and 2,299 deletions.
6 changes: 3 additions & 3 deletions graalvm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM ghcr.io/graalvm/graalvm-ce:java11-21.3.0 as graalvm
RUN gu install native-image
FROM ghcr.io/graalvm/native-image:21 as graalvm

COPY . /home/app/http4k-example
WORKDIR /home/app/http4k-example

RUN native-image --no-fallback --no-server -cp build/libs/Example-all.jar com.example.HelloWorldKt
RUN native-image --no-fallback -cp build/libs/example.jar com.example.HelloWorldKt

FROM frolvlad/alpine-glibc
RUN apk update && apk add libstdc++
EXPOSE 8080
COPY --from=graalvm /home/app/http4k-example/com.example.helloworldkt /app/http4k-example
RUN chmod 777 /app/http4k-example
ENTRYPOINT ["/app/http4k-example"]
48 changes: 0 additions & 48 deletions graalvm/build.gradle

This file was deleted.

70 changes: 70 additions & 0 deletions graalvm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.JavaVersion.VERSION_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.21"
id("com.github.johnrengelman.shadow") version "8.1.1"
}

buildscript {
repositories {
mavenCentral()
}
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "com.github.johnrengelman.shadow")

repositories {
mavenCentral()
}

val http4kVersion = providers.gradleProperty("http4kVersion").orNull
val kotlinVersion = providers.gradleProperty("kotlinVersion").orNull
val junitVersion = providers.gradleProperty("junitVersion").orNull

java {
sourceCompatibility = VERSION_11
targetCompatibility = VERSION_11
}

tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
allWarningsAsErrors = true
}
}

named<ShadowJar>("shadowJar") {
archiveBaseName.set("example")
archiveClassifier = ""
mergeServiceFiles()
manifest {
attributes(mapOf("Main-Class" to "com.example.HelloWorldKt"))
}
}

named<Test>("test").configure {
useJUnitPlatform {}
}

}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
implementation(platform("org.http4k:http4k-bom:${http4kVersion}"))
implementation("org.http4k:http4k-core")

testImplementation(platform("org.junit:junit-bom:${junitVersion}"))
testImplementation("org.http4k:http4k-testing-hamkrest")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
}
4 changes: 2 additions & 2 deletions graalvm/build_and_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

echo "Building http4k for GraalVM..."

docker build . -t http4k-graal-example
docker build --platform=linux/arm64/v8 --progress=plain . -t http4k-graal-example

echo "Running http4k on GraalVM..."
docker run -p 8080:8080 http4k-graal-example
docker run --platform=linux/arm64/v8 -p 8080:8080 http4k-graal-example
1 change: 0 additions & 1 deletion graalvm/settings.gradle

This file was deleted.

Empty file added graalvm/settings.gradle.kts
Empty file.
2 changes: 1 addition & 1 deletion react-app/frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.node-gradle.node" version "2.2.4"
id "com.github.node-gradle.node" version "7.0.1"
}

node {
Expand Down
Loading

0 comments on commit 272c993

Please sign in to comment.