mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
adding dockerfile
This commit is contained in:
parent
2daa3993ee
commit
17ffb6542d
1 changed files with 27 additions and 0 deletions
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Use an official OpenJDK 17 image as a base
|
||||
FROM openjdk:17-jdk-slim
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the Maven wrapper files
|
||||
COPY .mvn/ .mvn
|
||||
COPY mvnw pom.xml ./
|
||||
|
||||
# Grant execution permission to Maven wrapper
|
||||
RUN chmod +x ./mvnw
|
||||
|
||||
# Download and install Maven dependencies (will be cached if unchanged)
|
||||
RUN ./mvnw dependency:go-offline
|
||||
|
||||
# Copy the remaining project files
|
||||
COPY src ./src
|
||||
|
||||
# Build the application using Maven wrapper
|
||||
RUN ./mvnw clean package -DskipTests
|
||||
|
||||
# Expose the port on which the application will run
|
||||
EXPOSE 8080
|
||||
|
||||
# Run the Spring Boot application
|
||||
ENTRYPOINT ["java", "-jar", "target/spring-petclinic-2.6.0-SNAPSHOT.jar"]
|
Loading…
Reference in a new issue