-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 925 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (26 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#syntax=docker/dockerfile:1.2
### build stage ###
#FROM azul/zulu-openjdk:21 AS builder
FROM eclipse-temurin:21-jdk AS builder
# set arg
ARG WORKSPACE=/home/spring-docker
ARG BUILD_TARGET=${WORKSPACE}/build/libs
WORKDIR ${WORKSPACE}
COPY . .
RUN ./gradlew clean bootJar
# unpack jar
WORKDIR ${BUILD_TARGET}
RUN jar -xf *.jar
### create image stage ###
FROM eclipse-temurin:21-jdk
ARG WORKSPACE=/home/spring-docker
ARG BUILD_TARGET=${WORKSPACE}/build/libs
ARG DEPLOY_PATH=${WORKSPACE}/deploy
# copy from build stage
COPY --from=builder ${BUILD_TARGET}/org ${DEPLOY_PATH}/org
COPY --from=builder ${BUILD_TARGET}/BOOT-INF/lib ${DEPLOY_PATH}/BOOT-INF/lib
COPY --from=builder ${BUILD_TARGET}/META-INF ${DEPLOY_PATH}/META-INF
COPY --from=builder ${BUILD_TARGET}/BOOT-INF/classes ${DEPLOY_PATH}/BOOT-INF/classes
WORKDIR ${DEPLOY_PATH}
EXPOSE 8080/tcp
ENTRYPOINT ["java","org.springframework.boot.loader.launch.JarLauncher"]