From 7aa72562363906af305e0da4b74fcbfa85863969 Mon Sep 17 00:00:00 2001 From: Rajesh1b <118235010+Rajesh1b@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:40:51 +0530 Subject: [PATCH] Create Dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..20a007f7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use an official OpenJDK image as a base +FROM openjdk:17-slim + +# Set the working directory +WORKDIR /app + +# Copy the pom.xml and other necessary files first +COPY . . + +# Install Maven +RUN apt-get update && \ + apt-get install -y maven && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Expose the port +EXPOSE 8080 + +# Run Maven to build the application +RUN ./mvnw package + + + + +# Set the command to run the application +CMD ["java", "-jar", "target/spring-petclinic-3.3.0-SNAPSHOT.jar"]