dockerfile for spring boot app

FROM openjdk:8-jdk-alpine COPY target/spring-app.jar app.jar ENTRYPOINT ["java","-jar","/app.jar"]

Explanation: 1. FROM openjdk:8-jdk-alpine: This line specifies the base image for the Dockerfile, which is an Alpine Linux image with OpenJDK 8 installed.

  1. COPY target/spring-app.jar app.jar: This line copies the compiled Spring Boot application JAR file from the target directory of the host machine to the root directory of the Docker image, renaming it to app.jar.

  2. ENTRYPOINT ["java","-jar","/app.jar"]: This line sets the entry point command for the Docker container. It specifies that the Java Virtual Machine should be launched with the app.jar file as the executable JAR for the Spring Boot application.

These steps allow you to create a Docker image for a Spring Boot application and run it as a container. The image is based on OpenJDK 8, and the application JAR file is copied into the image. Finally, the entry point command is set to launch the Spring Boot application when the Docker container starts.