@@ -39,27 +39,30 @@ For example, using a `Dockerfile` you could express it in this form:
39
39
40
40
[indent=0]
41
41
----
42
- FROM openjdk:8-jdk-alpine AS builder
43
- WORKDIR target/dependency
44
- ARG fatjar
45
- COPY ${fatjar} app.jar
46
- RUN jar -xf ./app.jar
47
-
48
- FROM openjdk:8-jre-alpine
49
- VOLUME /tmp
50
- ARG DEPENDENCY=target/dependency
51
- COPY --from=builder ${DEPENDENCY}/BOOT-INF/lib /app/lib
52
- COPY --from=builder ${DEPENDENCY}/META-INF /app/META-INF
53
- COPY --from=builder ${DEPENDENCY}/BOOT-INF/classes /app
54
- ENTRYPOINT ["java","-cp","app:app/lib/*","com.example.MyApplication"]
55
- ----
56
- and then build your docker image by passing the full path to your application jar:
42
+ FROM openjdk:8-jdk-alpine AS builder
43
+ WORKDIR target/dependency
44
+ ARG appjar
45
+ COPY ${appjar} app.jar
46
+ RUN jar -xf ./app.jar
47
+
48
+ FROM openjdk:8-jre-alpine
49
+ VOLUME /tmp
50
+ ARG DEPENDENCY=target/dependency
51
+ COPY --from=builder ${DEPENDENCY}/BOOT-INF/lib /app/lib
52
+ COPY --from=builder ${DEPENDENCY}/META-INF /app/META-INF
53
+ COPY --from=builder ${DEPENDENCY}/BOOT-INF/classes /app
54
+ ENTRYPOINT ["java","-cp","app:app/lib/*","com.example.MyApplication"]
55
+ ----
56
+
57
+ Assuming the above `Dockerfile` is the current directory, your docker image can be built specifying the path to your application jar, as show in the following example:
58
+
57
59
[indent=0]
58
60
----
59
- docker build --build-arg fatjar=./full/ path/to/your/springboot/app .jar
61
+ docker build --build-arg appjar= path/to/myapp .jar .
60
62
----
61
63
62
64
65
+
63
66
[[cloud-deployment]]
64
67
== Deploying to the Cloud
65
68
Spring Boot's executable jars are ready-made for most popular cloud PaaS (Platform-as-a-Service) providers.
0 commit comments