mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
sajdiojqwoe
This commit is contained in:
parent
3e3d92ae5d
commit
50abcbcae1
1 changed files with 30 additions and 7 deletions
37
Dockerfile
37
Dockerfile
|
@ -1,14 +1,37 @@
|
|||
## Use an official OpenJDK runtime as a parent image
|
||||
#FROM openjdk:11-jdk-slim
|
||||
#
|
||||
## Set the working directory inside the container
|
||||
#WORKDIR /app
|
||||
#
|
||||
## Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory)
|
||||
#COPY target/*.jar app.jar
|
||||
#
|
||||
## Run the jar file
|
||||
#CMD ["java", "-jar", "app.jar"]
|
||||
#
|
||||
## Expose the port the app runs on
|
||||
#EXPOSE 8080
|
||||
|
||||
|
||||
# Use an official OpenJDK runtime as a parent image
|
||||
FROM openjdk:11-jdk-slim
|
||||
FROM openjdk
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory)
|
||||
COPY target/*.jar app.jar
|
||||
# Copy the Maven wrapper and the pom.xml file
|
||||
COPY .mvn/ .mvn
|
||||
COPY mvnw pom.xml ./
|
||||
|
||||
# Copy the project source code
|
||||
COPY src ./src
|
||||
|
||||
# Package the application
|
||||
RUN ./mvnw clean package
|
||||
|
||||
# Copy the JAR file to the app directory
|
||||
RUN cp /app/target/*.jar app.jar
|
||||
|
||||
# Run the jar file
|
||||
CMD ["java", "-jar", "app.jar"]
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 8080
|
||||
CMD ["java", "-jar", "app.jar"]
|
Loading…
Reference in a new issue