LicenseServer/Dockerfile

29 lines
648 B
Docker
Raw Normal View History

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