mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Create Dockerfile
This commit is contained in:
parent
cabb74ed53
commit
7aa7256236
1 changed files with 26 additions and 0 deletions
26
Dockerfile
Normal file
26
Dockerfile
Normal file
|
@ -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"]
|
Loading…
Reference in a new issue