Skip to content

Commit

Permalink
Use JDK 21
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed May 2, 2024
1 parent cafb6ae commit 9865bb6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- uses: actions/checkout@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3 # https://github.com/actions/setup-java
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
###############################################################################
# Stage 1 (to create a "build" image, ~360MB) #
###############################################################################
FROM eclipse-temurin:17-jdk-alpine AS builder
FROM eclipse-temurin:21-jdk-alpine AS builder

# Smoke test to verify if java is available.
RUN java -version
Expand All @@ -29,7 +29,7 @@ WORKDIR /usr/src/myapp/
RUN ./mvnw package

###############################################################################
# Stage 2 (to create a downsized "container executable", ~117MB) #
# Stage 2 (to create a downsized "container executable", ~131MB) #
###############################################################################
FROM alpine:latest
ENV JAVA_HOME=/jre
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Features:
- The Docker build uses a
[multi-stage build setup](https://docs.docker.com/build/building/multi-stage/)
including a downsized JRE (built inside Docker via `jlink`)
to minimize the size of the generated Docker image, which is **117MB**.
to minimize the size of the generated Docker image, which is **131MB**.
- Supports [Docker BuildKit](https://docs.docker.com/build/)
- Supports GraalVM to create
[native images](https://www.graalvm.org/latest/reference-manual/native-image/)
Expand All @@ -24,7 +24,7 @@ Features:
intentionally does not use these native app images because the majority of
Java developers do not use GraalVM. If you do want to use native images,
please modify [Dockerfile](Dockerfile) accordingly.
- Java 17 (Eclipse Temurin)
- Java 21 (Eclipse Temurin)
- [JUnit 5](https://github.com/junit-team/junit5) for demonstrating how to integrate unit testing
- Maven for build management, using [Maven Wrapper](https://github.com/apache/maven-wrapper)
- [GitHub Actions workflows](https://github.com/miguno/java-docker-build-tutorial/actions) for
Expand Down Expand Up @@ -114,7 +114,7 @@ $ just docker-image-create
# Notes

You can also build, test, package, and run the Java application locally
(without Docker) if you have JDK 17+ installed. You do not need to have Maven
(without Docker) if you have JDK 21+ installed. You do not need to have Maven
installed, because this repository contains the
[Maven Wrapper](https://github.com/apache/maven-wrapper) `mvnw` (use `mvnw.cmd`
on Windows).
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.release>${java.version}</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 9865bb6

Please sign in to comment.