Skip to content

Commit ccb3042

Browse files
authored
Merge pull request #22 from stuartwdouglas/ubi-image
Use UBI base images for SpringBoot sample
2 parents a2ba645 + 70e9667 commit ccb3042

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docker/Dockerfile

+8-10
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
#
1010
# docker run -i --rm -p 8081:8081 springboot/sample-demo
1111
####
12-
FROM quay.io/devfile/maven:3.8.1-openjdk-17-slim
13-
14-
WORKDIR /build
12+
FROM registry.access.redhat.com/ubi8/openjdk-17:1.14 AS builder
1513

1614
# Build dependency offline to streamline build
1715
COPY pom.xml .
@@ -21,12 +19,12 @@ COPY src src
2119
RUN mvn package -Dmaven.test.skip=true
2220
# compute the created jar name and put it in a known location to copy to the next layer.
2321
# If the user changes pom.xml to have a different version, or artifactId, this will find the jar
24-
RUN grep version /build/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-version
25-
RUN grep artifactId /build/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-id
26-
RUN mv /build/target/$(cat .env-id)-$(cat .env-version).jar /build/target/export-run-artifact.jar
27-
28-
FROM openjdk:11-jdk
29-
COPY --from=0 /build/target/export-run-artifact.jar /app/target/export-run-artifact.jar
22+
RUN grep version /home/jboss/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-version
23+
RUN grep artifactId /home/jboss/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-id
24+
RUN mv /home/jboss/target/$(cat .env-id)-$(cat .env-version).jar /home/jboss/target/export-run-artifact.jar
3025

26+
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15
27+
COPY --from=builder /home/jboss/target/export-run-artifact.jar /deployments/export-run-artifact.jar
3128
EXPOSE 8081
32-
ENTRYPOINT [ "java", "-jar", "/app/target/export-run-artifact.jar", "--server.port=8081" ]
29+
ENTRYPOINT ["/opt/jboss/container/java/run/run-java.sh", "--server.port=8081"]
30+

0 commit comments

Comments
 (0)