29 lines
807 B
Docker
29 lines
807 B
Docker
# Use the official maven/Java 17 image to create a build artifact.
|
|
# https://hub.docker.com/_/maven
|
|
FROM maven:3.9.1-eclipse-temurin-17 AS build
|
|
|
|
# Set the working directory in the image to /app
|
|
WORKDIR /app
|
|
|
|
# Copy the pom.xml file into the current directory (/app) in the image
|
|
COPY pom.xml .
|
|
|
|
# Download all required dependencies into one layer
|
|
RUN mvn -B dependency:go-offline
|
|
|
|
# Copy the rest of the application source code
|
|
COPY src /app/src
|
|
|
|
# Build the application
|
|
RUN mvn -B package -DskipTests
|
|
|
|
# Use OpenJDK 17 for the runtime stage of the Dockerfile
|
|
FROM openjdk:17-jdk-slim
|
|
|
|
# Copy the jar file from the build stage
|
|
COPY --from=build /app/target/easydrop-0.3.0-SNAPSHOT.jar /easydrop.jar
|
|
|
|
# Execute the application when the docker container starts.
|
|
ENTRYPOINT ["java", "-jar", "/easydrop.jar"]
|
|
|