-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (26 loc) · 954 Bytes
/
Dockerfile
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
# Stage 1: Build the application
FROM maven:3.8.1-openjdk-16-slim AS build
# Set the working directory in the Docker image
WORKDIR /app
# Copy the root pom.xml file to download dependencies
COPY pom.xml .
# Copy the pom.xml file of subprojects
COPY apex-main/pom.xml ./apex-main/
COPY apex-mbg/pom.xml ./apex-mbg/
# Download dependencies as specified in pom.xml
RUN mvn dependency:go-offline -B
# Copy the rest of the application code
COPY apex-main/src ./apex-main/src
COPY apex-mbg/src ./apex-mbg/src
# Package the application
RUN mvn package -DskipTests
# Stage 2: Run the application
FROM openjdk:16-slim
# Add Maintainer Info
LABEL maintainer="your_email@example.com"
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Copy the jar file from the build stage
COPY --from=build /app/apex-main/target/*.jar app.jar
# Run the jar file
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]