mirror of https://github.com/knative/docs.git
Improve Java Hello World (#1111)
* Use AdoptOpenJDK for newest version of JDK that has proper container support. Upgraded Spring Boot version. * updated to AdoptOpenJDK
This commit is contained in:
parent
f7552b51a7
commit
42cf75ff18
|
|
@ -0,0 +1 @@
|
||||||
|
target/
|
||||||
|
|
@ -10,10 +10,11 @@ COPY src ./src
|
||||||
# Build a release artifact.
|
# Build a release artifact.
|
||||||
RUN mvn package -DskipTests
|
RUN mvn package -DskipTests
|
||||||
|
|
||||||
# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
|
# Use AdoptOpenJDK for base image.
|
||||||
# https://hub.docker.com/_/openjdk
|
# It's important to use OpenJDK 8u191 or above that has container support enabled.
|
||||||
|
# https://hub.docker.com/r/adoptopenjdk/openjdk8
|
||||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||||
FROM openjdk:8-jre-alpine
|
FROM adoptopenjdk/openjdk8:jdk8u202-b08-alpine-slim
|
||||||
|
|
||||||
# Copy the jar to the production image from the builder stage.
|
# Copy the jar to the production image from the builder stage.
|
||||||
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar
|
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,11 @@ recreate the source files from this folder.
|
||||||
# Build a release artifact.
|
# Build a release artifact.
|
||||||
RUN mvn package -DskipTests
|
RUN mvn package -DskipTests
|
||||||
|
|
||||||
# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
|
# Use AdoptOpenJDK for base image.
|
||||||
# https://hub.docker.com/_/openjdk
|
# It's important to use OpenJDK 8u191 or above that has container support enabled.
|
||||||
|
# https://hub.docker.com/r/adoptopenjdk/openjdk8
|
||||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||||
FROM openjdk:8-jre-alpine
|
FROM adoptopenjdk/openjdk8:jdk8u202-b08-alpine-slim
|
||||||
|
|
||||||
# Copy the jar to the production image from the builder stage.
|
# Copy the jar to the production image from the builder stage.
|
||||||
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar
|
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.0.3.RELEASE</version>
|
<version>2.1.3.RELEASE</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ COPY src ./src
|
||||||
# Build a release artifact.
|
# Build a release artifact.
|
||||||
RUN gradle clean build --no-daemon
|
RUN gradle clean build --no-daemon
|
||||||
|
|
||||||
# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
|
# Use AdoptOpenJDK for base image.
|
||||||
# https://hub.docker.com/_/openjdk
|
# It's important to use OpenJDK 8u191 or above that has container support enabled.
|
||||||
|
# https://hub.docker.com/r/adoptopenjdk/openjdk8
|
||||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||||
FROM openjdk:8-jre-alpine
|
FROM adoptopenjdk/openjdk8:jdk8u202-b08-alpine-slim
|
||||||
|
|
||||||
# Copy the jar to the production image from the builder stage.
|
# Copy the jar to the production image from the builder stage.
|
||||||
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar
|
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,11 @@ recreate the source files from this folder.
|
||||||
# Build a release artifact.
|
# Build a release artifact.
|
||||||
RUN gradle clean build --no-daemon
|
RUN gradle clean build --no-daemon
|
||||||
|
|
||||||
# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
|
# Use AdoptOpenJDK for base image.
|
||||||
# https://hub.docker.com/_/openjdk
|
# It's important to use OpenJDK 8u191 or above that has container support enabled.
|
||||||
|
# https://hub.docker.com/r/adoptopenjdk/openjdk8
|
||||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||||
FROM openjdk:8-jre-alpine
|
FROM adoptopenjdk/openjdk8:jdk8u202-b08-alpine-slim
|
||||||
|
|
||||||
# Copy the jar to the production image from the builder stage.
|
# Copy the jar to the production image from the builder stage.
|
||||||
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar
|
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue