Skip to content

Commit 0ce9fe7

Browse files
committed
documented dockerfile
1 parent bfe7da7 commit 0ce9fe7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM maven:3.6.3-jdk-11 as MAVEN_BUILD
2+
3+
MAINTAINER Armand Ballaci
4+
5+
COPY pom.xml .
6+
7+
COPY src src
8+
9+
RUN mvn dependency:go-offline -B
10+
11+
RUN mvn clean package -DskipTests
12+
13+
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
14+
15+
# Production Stage for Spring boot application image
16+
# Also, there is a clean separation between dependencies and application resources in a Spring Boot fat jar file,
17+
# and we can use that fact to improve performance. The key is to create layers in the container filesystem.
18+
# The layers are cached both at build time and at runtime (in most runtimes) so we want the most frequently changing resources,
19+
# usually the class and static resources in the application itself, to be layered after the more slowly changing resources.
20+
# Thus we will use a slightly different implementation of the Dockerfile: https://spring.io/guides/gs/spring-boot-docker/
21+
FROM openjdk:11-jdk-slim as production
22+
ARG DEPENDENCY=target/dependency
23+
COPY --from=MAVEN_BUILD ${DEPENDENCY}/BOOT-INF/lib /app/lib
24+
COPY --from=MAVEN_BUILD ${DEPENDENCY}/META-INF /app/META-INF
25+
COPY --from=MAVEN_BUILD ${DEPENDENCY}/BOOT-INF/classes /app
26+
EXPOSE 8080
27+
ENTRYPOINT ["java","-cp","app:app/lib/*","de.ballaci.jpa.SakilaApplication"]

0 commit comments

Comments
 (0)