From f49028071fe1759b579bdc84a509accacf291a37 Mon Sep 17 00:00:00 2001 From: Souyama Date: Fri, 26 May 2023 10:53:41 +0000 Subject: [PATCH 1/2] Update Dockerfile - to use `eclipse-temurin` base image - replace `openjdk` image which has been deprecated --- README.adoc | 4 ++-- complete/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index ea762702..3bacaf40 100644 --- a/README.adoc +++ b/README.adoc @@ -84,7 +84,7 @@ Docker has a simple https://docs.docker.com/reference/builder/["Dockerfile"] fil ==== [source] ---- -FROM openjdk:8-jdk-alpine +FROM eclipse-temurin:8-jdk-alpine ARG JAR_FILE=target/*.jar COPY ${JAR_FILE} app.jar ENTRYPOINT ["java","-jar","/app.jar"] @@ -122,7 +122,7 @@ So, an important improvement to the `Dockerfile` is to run the application as a ==== [source] ---- -FROM openjdk:8-jdk-alpine +FROM eclipse-temurin:8-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring ARG JAR_FILE=target/*.jar diff --git a/complete/Dockerfile b/complete/Dockerfile index 9f20b3e8..dba16ec7 100644 --- a/complete/Dockerfile +++ b/complete/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM eclipse-temurin:8-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring ARG DEPENDENCY=target/dependency From 7de3fcbd730cdbe47a8cbeca7714480fa3f520a6 Mon Sep 17 00:00:00 2001 From: Souyama Date: Fri, 26 May 2023 11:51:59 +0000 Subject: [PATCH 2/2] Upgrade artifacts to use java 17 - bring all java versions to consistency --- README.adoc | 8 ++++---- complete/{.jdk8 => .jdk17} | 0 complete/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename complete/{.jdk8 => .jdk17} (100%) diff --git a/README.adoc b/README.adoc index 3bacaf40..4a46f77a 100644 --- a/README.adoc +++ b/README.adoc @@ -13,7 +13,7 @@ NOTE: There is also a https://spring.io/guides/topicals/spring-boot-docker[Topic https://docker.com[Docker] is a Linux container management toolkit with a "`social`" aspect, letting users publish container images and consume those published by others. A Docker image is a recipe for running a containerized process. In this guide, we build one for a simple Spring boot application. == What You Will Need -:java_version: 1.8 +:java_version: 17 include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/prereq_editor_jdk_buildtools.adoc[] If you are NOT using a Linux machine, you need a virtualized server. If you install VirtualBox, other tools like the Mac's `boot2docker` can seamlessly manage it for you. Visit https://www.virtualbox.org/wiki/Downloads[VirtualBox's download site] and pick the version for your machine. Download and install. Do not worry about actually running it. @@ -23,7 +23,7 @@ You also need https://docker.com[Docker], which only runs on 64-bit machines. Se [[scratch]] == Starting with Spring Initializr -You can use this https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.5&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=spring-boot-docker&name=spring-boot-docker&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.spring-boot-docker&dependencies=web[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial. +You can use this https://start.spring.io/#!type=maven-project&language=java&platformVersion=3.0.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=spring-boot-docker&name=spring-boot-docker&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.spring-boot-docker&dependencies=web[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial. To manually initialize the project: @@ -84,7 +84,7 @@ Docker has a simple https://docs.docker.com/reference/builder/["Dockerfile"] fil ==== [source] ---- -FROM eclipse-temurin:8-jdk-alpine +FROM eclipse-temurin:17-jdk-alpine ARG JAR_FILE=target/*.jar COPY ${JAR_FILE} app.jar ENTRYPOINT ["java","-jar","/app.jar"] @@ -122,7 +122,7 @@ So, an important improvement to the `Dockerfile` is to run the application as a ==== [source] ---- -FROM eclipse-temurin:8-jdk-alpine +FROM eclipse-temurin:17-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring ARG JAR_FILE=target/*.jar diff --git a/complete/.jdk8 b/complete/.jdk17 similarity index 100% rename from complete/.jdk8 rename to complete/.jdk17 diff --git a/complete/Dockerfile b/complete/Dockerfile index dba16ec7..244f4ecb 100644 --- a/complete/Dockerfile +++ b/complete/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse-temurin:8-jdk-alpine +FROM eclipse-temurin:17-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring ARG DEPENDENCY=target/dependency