2024-09-06 18:50:29 +00:00
|
|
|
# Use a Maven image with OpenJDK
|
2024-09-06 18:09:35 +00:00
|
|
|
FROM maven:3.9.4-eclipse-temurin-21-alpine AS build
|
2024-09-06 17:48:36 +00:00
|
|
|
|
2024-09-06 18:50:29 +00:00
|
|
|
# Install Node.js (for Vaadin frontend tasks)
|
|
|
|
RUN apk add --no-cache nodejs npm
|
|
|
|
|
2024-09-06 17:48:36 +00:00
|
|
|
# Set the working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
2024-09-06 18:50:29 +00:00
|
|
|
# Copy the Maven POM file and source code
|
2024-09-06 18:47:43 +00:00
|
|
|
COPY pom.xml ./
|
|
|
|
COPY src ./src
|
2024-09-06 17:48:36 +00:00
|
|
|
|
2024-09-06 18:47:43 +00:00
|
|
|
# Package the application
|
2024-09-06 17:48:36 +00:00
|
|
|
RUN mvn clean package -DskipTests
|
|
|
|
|
2024-09-06 18:50:29 +00:00
|
|
|
# Use a JDK image to run the JAR
|
|
|
|
FROM eclipse-temurin:21-jdk-alpine
|
2024-09-06 16:54:26 +00:00
|
|
|
|
|
|
|
# Set the working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
2024-09-06 17:48:36 +00:00
|
|
|
# Copy the JAR file from the build stage
|
2024-09-06 18:50:29 +00:00
|
|
|
COPY --from=build /app/target/munera-1.0-SNAPSHOT.jar ./munera-1.0-SNAPSHOT.jar
|
2024-09-06 16:54:26 +00:00
|
|
|
|
|
|
|
# Expose the port the app runs on
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
# Run the JAR file
|
2024-09-06 18:50:29 +00:00
|
|
|
CMD ["java", "-jar", "/app/munera-1.0-SNAPSHOT.jar"]
|