Skip to content

Commit 905e69a

Browse files
authored
Upgrade to patched Corretto 21 and increase Metaspace limit (#561)
* Updated tzdata * Increase JVM Metaspace limit to 300 MB
1 parent c1ab499 commit 905e69a

3 files changed

Lines changed: 30 additions & 17 deletions

File tree

‎.github/workflows/on.pr.yml‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
- main
88
paths:
99
- 'api/**'
10+
- 'Dockerfile'
11+
- '.github/workflows/*'
1012
jobs:
1113
quality_profile:
1214

@@ -20,11 +22,12 @@ jobs:
2022
- uses: actions/checkout@v4
2123
with:
2224
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
23-
- name: Set up JDK 18
25+
- name: Set up JDK 21
2426
uses: actions/setup-java@v4
2527
with:
2628
distribution: 'corretto'
27-
java-version: 18
29+
java-version: '21'
30+
check-latest: true
2831
- uses: actions/cache@v4
2932
with:
3033
path: ~/.m2/repository
@@ -33,11 +36,6 @@ jobs:
3336
${{ runner.os }}-maven-5Jun-
3437
- name: Run unit tests
3538
run: mvn -f pom.xml clean package
36-
- name: Set up JDK 21 for Sonar
37-
uses: actions/setup-java@v4
38-
with:
39-
distribution: 'corretto'
40-
java-version: 21
4139
- name: Cache SonarCloud packages
4240
uses: actions/cache@v4
4341
with:

‎Dockerfile‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
FROM artifacts.developer.gov.bc.ca/docker-remote/maven:3.8.7-openjdk-18 as build
1+
FROM artifacts.developer.gov.bc.ca/docker-remote/maven:3.9.9-amazoncorretto-21-alpine AS maven
2+
3+
# Use the timezone-patched JDK for both compilation and the final runtime.
4+
FROM artifacts.developer.gov.bc.ca/docker-remote/amazoncorretto:21.0.12-alpine3.23 AS build
5+
COPY --from=maven /usr/share/maven /usr/share/maven
6+
ENV PATH="/usr/share/maven/bin:${PATH}"
27
WORKDIR /workspace/app
38

49
COPY api/pom.xml .
510
COPY api/src src
611
RUN mvn package -DskipTests
712
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
813

9-
FROM artifacts.developer.gov.bc.ca/docker-remote/openjdk:18.0.2.1-jdk-oracle
10-
RUN useradd -ms /bin/bash spring && mkdir -p /logs && chown -R spring:spring /logs && chmod 755 /logs
14+
FROM artifacts.developer.gov.bc.ca/docker-remote/amazoncorretto:21.0.12-alpine3.23
15+
RUN adduser -D -h /home/spring -s /bin/sh spring && mkdir -p /logs && chown -R spring:spring /logs && chmod 755 /logs
1116
USER spring
1217
VOLUME /tmp
1318
ARG DEPENDENCY=/workspace/app/target/dependency
1419
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
1520
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
1621
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
17-
ENTRYPOINT ["java","-Duser.name=EDUC_GRAD_RULE_ENGINE_API","-Xms512m","-Xmx512m","-noverify","-XX:TieredStopAtLevel=1",\
22+
ENTRYPOINT ["java","-Duser.name=EDUC_GRAD_RULE_ENGINE_API","-Xms512m","-Xmx512m","-XX:TieredStopAtLevel=1",\
1823
"-XX:+UseParallelGC","-XX:MinHeapFreeRatio=20","-XX:MaxHeapFreeRatio=40","-XX:GCTimeRatio=4",\
19-
"-XX:AdaptiveSizePolicyWeight=90","-XX:MaxMetaspaceSize=100m","-XX:ParallelGCThreads=1",\
24+
"-XX:AdaptiveSizePolicyWeight=90","-XX:MaxMetaspaceSize=300m","-XX:ParallelGCThreads=1",\
2025
"-Djava.util.concurrent.ForkJoinPool.common.parallelism=1","-XX:CICompilerCount=2",\
2126
"-XX:+ExitOnOutOfMemoryError","-Djava.security.egd=file:/dev/./urandom",\
2227
"-Dspring.backgroundpreinitializer.ignore=true","-cp","app:app/lib/*",\

‎api/pom.xml‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.2</version>
8+
<version>3.0.13</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>ca.bc.gov.educ</groupId>
@@ -24,7 +24,10 @@
2424
src/main/java/ca/bc/gov/educ/api/ruleengine/util/**,
2525
src/main/java/ca/bc/gov/educ/api/ruleengine/controller/APIMetadataController.java
2626
</sonar.exclusions>
27-
<java.version>18</java.version>
27+
<java.version>21</java.version>
28+
<lombok.version>1.18.32</lombok.version>
29+
<jacoco.version>0.8.12</jacoco.version>
30+
<byte-buddy.version>1.14.19</byte-buddy.version>
2831
<maven.compiler.version>3.10.1</maven.compiler.version>
2932
<maven.compiler.source>${java.version}</maven.compiler.source>
3033
<maven.compiler.target>${java.version}</maven.compiler.target>
@@ -204,12 +207,12 @@
204207
<plugin>
205208
<groupId>org.sonarsource.scanner.maven</groupId>
206209
<artifactId>sonar-maven-plugin</artifactId>
207-
<version>3.9.1.2184</version>
210+
<version>5.8.0.7211</version>
208211
</plugin>
209212
<plugin>
210213
<groupId>org.jacoco</groupId>
211214
<artifactId>jacoco-maven-plugin</artifactId>
212-
<version>0.8.8</version>
215+
<version>${jacoco.version}</version>
213216
</plugin>
214217
<plugin>
215218
<groupId>org.apache.maven.plugins</groupId>
@@ -262,7 +265,14 @@
262265
<plugin>
263266
<groupId>org.hibernate.orm.tooling</groupId>
264267
<artifactId>hibernate-enhance-maven-plugin</artifactId>
265-
<version>6.1.1.Final</version>
268+
<version>${hibernate.version}</version>
269+
<dependencies>
270+
<dependency>
271+
<groupId>net.bytebuddy</groupId>
272+
<artifactId>byte-buddy</artifactId>
273+
<version>${byte-buddy.version}</version>
274+
</dependency>
275+
</dependencies>
266276
<executions>
267277
<execution>
268278
<configuration>

0 commit comments

Comments
 (0)