2023-05-31 22:32:42 -04:00
|
|
|
# Stage 1: Building
|
2023-05-31 02:31:48 -04:00
|
|
|
FROM maven:3.8.5-openjdk-17-slim AS builder
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Set the work dir inside the container
|
2023-05-31 02:31:48 -04:00
|
|
|
WORKDIR /app
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Copy the POM file to the work dir
|
2023-05-31 02:31:48 -04:00
|
|
|
COPY pom.xml .
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Copy src to the work dir
|
2023-05-31 02:31:48 -04:00
|
|
|
COPY src ./src
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Run Maven to clean and package the app
|
2023-05-31 16:45:19 -04:00
|
|
|
RUN mvn clean package -T12
|
2023-05-31 02:31:48 -04:00
|
|
|
|
2023-05-31 22:32:42 -04:00
|
|
|
# Stage 2: Running
|
2023-12-02 00:22:37 -05:00
|
|
|
FROM openjdk:17.0.2-jdk-slim
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Set the work dir inside the container
|
2023-05-31 16:45:19 -04:00
|
|
|
WORKDIR /usr/local/app
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Copy the compiled JAR file from the builder stage to the work dir
|
2023-05-31 02:31:48 -04:00
|
|
|
COPY --from=builder /app/target/LicenseServer.jar .
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Expose the port
|
2023-05-31 02:43:59 -04:00
|
|
|
EXPOSE 7500
|
2023-05-31 22:32:42 -04:00
|
|
|
|
|
|
|
# Set the command to run the app when the container starts
|
2023-05-31 18:49:09 -04:00
|
|
|
CMD ["java", "-jar", "LicenseServer.jar"]
|