Packaging and Containers
Java applications can be packaged as JARs and deployed directly or inside containers.
FROM eclipse-temurin:21-jre
COPY app.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
The runtime image should match the supported JDK/runtime and patch strategy. Avoid embedding secrets in image layers.
Key Takeaways
- Build artifacts should be immutable and reproducible.
- Runtime configuration belongs outside the image.
- Use a supported, patched Java runtime image.