I want to crate docker image with java 17 and maven. My idea was to use openjdk image with java 17 but I see that opendjk is deprecated.
- What does it mean that is deprecated? It will work but without update?
- What image can I use for it? is there any one ready with java 17 and maven ?
- Can I use it for comercial purposes?
2
Answers
you can use this Dockerfile for java 17
FROM openjdk:17-jdk-slim AS build
COPY pom.xml mvnw ./
COPY .mvn .mvn
RUN ./mvnw dependency:resolve
COPY src src
RUN ./mvnw package
FROM openjdk:17-jdk-slim
WORKDIR demo
COPY –from=build target/*.jar demo.jar
ENTRYPOINT ["java", "-jar", "demo.jar"]
Here’s a good article:
In other words, the only thing that’s "deprecated" is the prebuilt Docker image. Not OpenJDK, and certainly not Java 17.
It simply means that you’re responsible for adding the JDK of your choice to whatever Docker image you decide to use.
Another alternative – which the same link goes on to suggest – is getting an image from the Adoptium project: