Skip to content

Commit

Permalink
Upgrade Gradle to v8 and Docker to Java 21.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentg committed Nov 28, 2024
1 parent e4d25a0 commit abcd447
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM gradle:jdk11 AS build
FROM gradle:jdk21 AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN git config --global --add safe.directory /home/gradle/src
RUN gradle build
RUN unzip -d /app build/distributions/gtfsvtor.zip
RUN mv /app/*-* /app/gtfsvtor

FROM openjdk:11-jre-slim
FROM openjdk:21-jdk-slim
LABEL maintainer="Holger Bruch [email protected]"

COPY --from=build /app /app
Expand All @@ -13,4 +15,4 @@ WORKDIR /data
ENV GTFSVTOR_OPTS=-Xmx4G

ENTRYPOINT ["/app/gtfsvtor/bin/gtfsvtor"]
CMD ["-h"]
CMD ["-h"]
28 changes: 13 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ plugins {
id 'java'
id 'application'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

description = 'GTFSVTOR - General Transit Feed Specification Validator'
version = '1.0.3'
mainClassName = 'com.mecatran.gtfsvtor.cmdline.GtfsVtorMain'
applicationDefaultJvmArgs = [ "-Xmx4G" ]
application {
mainClass = 'com.mecatran.gtfsvtor.cmdline.GtfsVtorMain'
applicationDefaultJvmArgs = [ "-Xmx4G" ]
}

repositories {
mavenCentral()
Expand All @@ -17,20 +21,14 @@ startScripts {
applicationName = 'gtfsvtor'
}
distZip {
archiveFileName = "gtfsvtor.zip"
}
tasks.distTar.enabled = false

// Return the current commit hash from git
def scmRevisionInfo() {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'git'
args = [ 'rev-parse', 'HEAD' ]
standardOutput = os
}
return os.toString().trim()
}
}
ext.scmRevision = providers.exec {
commandLine('git', 'rev-parse', 'HEAD')
}.standardOutput.asText.get().trim()

def utcDateTime() {
def df = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm 'UTC'");
Expand All @@ -44,7 +42,7 @@ jar {
'Implementation-Version': version,
'Built-By' : System.properties['user.name'],
'Build-Date' : utcDateTime(),
'Build-Revision' : scmRevisionInfo(),
'Build-Revision' : scmRevision,
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
Expand Down

0 comments on commit abcd447

Please sign in to comment.