Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
.git
*.log
*.tmp
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use an official OpenJDK runtime as a parent image suitable for Java 17
FROM openjdk:17-jdk

# Set the working directory in the container
WORKDIR /app

# Copy the Maven Wrapper and pom.xml to the container
COPY mvnw .
COPY pom.xml ./

# Copy the project source to the container
COPY src ./src

# Make the mvnw file executable
RUN chmod +x mvnw

# Verify the installed Java version
RUN java -version

# Package the application code
RUN ./mvnw package -DskipTests

# Move the built application to the app directory (assuming a typical target directory structure)
RUN mv target/*.jar app.jar

# Make port 8080 available to the world outside this container
EXPOSE 8080

# Run the JAR file
CMD ["java", "-jar", "app.jar"]