diff --git a/build.gradle.kts b/build.gradle.kts index 10a7975..401c721 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,11 +4,11 @@ plugins { kotlin("jvm") version "1.7.20" apply false id("org.jmailen.kotlinter") version "3.12.0" apply false id("com.github.ben-manes.versions") version "0.43.0" - id("com.google.devtools.ksp").version("1.7.20-1.0.7") apply false + id("com.google.devtools.ksp").version("1.7.20-1.0.8") apply false } subprojects { group = "com.github.cs125-illinois.questioner" - version = "2022.10.7" + version = "2022.11.0" tasks.withType { kotlinOptions { jvmTarget = JavaVersion.VERSION_17.toString() diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 3af4ad6..e623558 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -12,9 +12,9 @@ dependencies { implementation("org.ow2.asm:asm:9.4") api("com.beyondgrader.resource-agent:agent:2022.9.3") - api("com.github.cs125-illinois.jeed:core:2022.10.8") + api("com.github.cs125-illinois.jeed:core:2022.11.0") api("com.github.cs125-illinois:jenisol:2022.10.5") - api("io.kotest:kotest-runner-junit5:5.5.3") + api("io.kotest:kotest-runner-junit5:5.5.4") api("com.google.truth:truth:1.1.3") api("com.github.cs125-illinois:libcs1:2022.10.0") } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index f681676..91795d7 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -19,12 +19,12 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.google.googlejavaformat:google-java-format:1.15.0") implementation("com.google.guava:guava:31.1-jre") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.0") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0") implementation("com.github.slugify:slugify:3.0.2") implementation("org.apache.httpcomponents.client5:httpclient5-fluent:5.1.3") - testImplementation("io.kotest:kotest-runner-junit5:5.5.3") + testImplementation("io.kotest:kotest-runner-junit5:5.5.4") } tasks.compileKotlin { dependsOn(tasks.generateGrammarSource) diff --git a/server/Dockerfile b/server/Dockerfile index 7f73c1c..d8011db 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,19 +1,25 @@ FROM openjdk:17-jdk-slim + +ARG TARGETARCH +ENV TINI_VERSION v0.19.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini +RUN chmod +x /tini +ENTRYPOINT ["/tini", "--"] + WORKDIR / COPY *.jar questioner.jar -CMD [\ - "java",\ - "-ea", "--enable-preview", "-Dfile.encoding=UTF-8",\ - "-Xms512m", "-Xmx2G", "-Xss256k", "-XX:+UseZGC", "-XX:ZCollectionInterval=8",\ - "-XX:-OmitStackTraceInFastThrow",\ - "--add-opens", "java.base/java.lang=ALL-UNNAMED",\ - "--add-opens", "java.base/java.util=ALL-UNNAMED",\ - "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",\ - "--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",\ - "--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",\ - "--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",\ - "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",\ - "--add-exports", "java.management/sun.management=ALL-UNNAMED",\ - "-jar", "questioner.jar"\ -] +CMD java -ea --enable-preview -Dfile.encoding=UTF-8 \ + -Xms1G -Xmx1G -Xss256k \ + -XX:+UseZGC -XX:ZCollectionInterval=8 -XX:-OmitStackTraceInFastThrow \ + --add-opens java.base/java.lang=ALL-UNNAMED \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ + --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ + --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ + --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ + --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ + --add-exports java.management/sun.management=ALL-UNNAMED \ + $JAVA_OPTS \ + -jar questioner.jar + # vim: tw=0 diff --git a/server/build.gradle.kts b/server/build.gradle.kts index ae8dd63..c0dbd1d 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -9,7 +9,6 @@ plugins { application id("org.jmailen.kotlinter") id("com.github.johnrengelman.shadow") version "7.1.2" - id("com.palantir.docker") version "0.34.0" id("com.google.devtools.ksp") } dependencies { @@ -25,7 +24,7 @@ dependencies { implementation("org.slf4j:slf4j-api:2.0.3") implementation("ch.qos.logback:logback-classic:1.4.4") - implementation("io.github.microutils:kotlin-logging:3.0.3") + implementation("io.github.microutils:kotlin-logging:3.0.4") } task("createProperties") { doLast { @@ -54,15 +53,37 @@ tasks.shadowJar { application { mainClass.set("edu.illinois.cs.cs125.questioner.server.MainKt") } -docker { - name = "cs125/questioner" - files(tasks["shadowJar"].outputs) - @Suppress("DEPRECATION") - tags("latest") -} kotlin { kotlinDaemonJvmArgs = listOf("-Dfile.encoding=UTF-8") } tasks.withType { isZip64 = true } +val dockerName = "cs125/questioner" +tasks.register("dockerCopyJar") { + from(tasks["shadowJar"].outputs) + into("${buildDir}/docker") +} +tasks.register("dockerCopyDockerfile") { + from("${projectDir}/Dockerfile") + into("${buildDir}/docker") +} +tasks.register("dockerBuild") { + dependsOn("dockerCopyJar", "dockerCopyDockerfile") + workingDir("${buildDir}/docker") + commandLine( + ("docker build . " + + "-t ${dockerName}:latest " + + "-t ${dockerName}:${project.version}").split(" ") + ) +} +tasks.register("dockerPush") { + dependsOn("dockerCopyJar", "dockerCopyDockerfile") + workingDir("${buildDir}/docker") + commandLine( + ("docker buildx build . --platform=linux/amd64,linux/arm64/v8 " + + "--builder multiplatform " + + "--tag ${dockerName}:latest " + + "--tag ${dockerName}:${project.version} --push").split(" ") + ) +} diff --git a/server/src/main/resources/edu.illinois.cs.cs125.questioner.server.version b/server/src/main/resources/edu.illinois.cs.cs125.questioner.server.version index 88a7816..b4d8963 100644 --- a/server/src/main/resources/edu.illinois.cs.cs125.questioner.server.version +++ b/server/src/main/resources/edu.illinois.cs.cs125.questioner.server.version @@ -1 +1 @@ -version=2022.10.7 \ No newline at end of file +version=2022.11.0 \ No newline at end of file