-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.openj9
45 lines (34 loc) · 1.36 KB
/
Dockerfile.openj9
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
35
36
37
38
39
40
41
42
43
44
45
ARG JAVA_VERSION=17
ARG BUILD_STAGE_WORKDIR=/home/sports-club-api
#--- Build Stage ---#
FROM vtramo/openj9:jdk-${JAVA_VERSION} AS build-stage
# Install curl
RUN apt-get update && apt-get install -y curl
ARG BUILD_STAGE_WORKDIR
WORKDIR ${BUILD_STAGE_WORKDIR}
# Copy Maven Wrapper
COPY ./.mvn ./.mvn
COPY ./mvnw .
RUN chmod 744 ./mvnw
# Fetch all application dependencies
COPY ./pom.xml ./pom.xml
RUN --mount=type=cache,target=/root/.m2 \
./mvnw '-Djava.version=${JAVA_VERSION}' dependency:go-offline -DexcludeGroupIds=org.openapitools
# Compile and package the application
COPY ./src ./src
RUN --mount=type=cache,target=/root/.m2 ./mvnw package -Dmaven.test.skip \
&& mkdir -p target/dependency \
&& cd target/dependency \
&& jar -xf ../*.jar
#--- Final Stage ---#
FROM vtramo/openj9:java-${JAVA_VERSION}
ARG BUILD_STAGE_WORKDIR
ARG DEPENDENCY=target/dependency
COPY --from=build-stage /${BUILD_STAGE_WORKDIR}/${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build-stage /${BUILD_STAGE_WORKDIR}/${DEPENDENCY}/BOOT-INF/classes /app
COPY --from=build-stage /${BUILD_STAGE_WORKDIR}/${DEPENDENCY}/BOOT-INF/lib /app/lib
# Install curl
RUN apt-get update && apt-get install -y curl
ENTRYPOINT ["java","-cp","/app:/app/lib/*","systems.fervento.sportsclub.SportsClubApp"]
EXPOSE 8083
HEALTHCHECK CMD curl -f http://localhost:8083/api/actuator/health || exit 1