feat: changed Dockerfile, docker-compose.yml

This commit is contained in:
filippo-ferrari 2024-09-06 20:50:29 +02:00
parent 17f8642a8b
commit c094ad48f0

View file

@ -1,24 +1,27 @@
# Use a Maven image to build the JAR # Use a Maven image with OpenJDK
FROM maven:3.9.4-eclipse-temurin-21-alpine AS build FROM maven:3.9.4-eclipse-temurin-21-alpine AS build
# Install Node.js (for Vaadin frontend tasks)
RUN apk add --no-cache nodejs npm
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
# Copy the pom.xml and the source code # Copy the Maven POM file and source code
COPY pom.xml ./ COPY pom.xml ./
COPY src ./src COPY src ./src
# Package the application # Package the application
RUN mvn clean package -DskipTests RUN mvn clean package -DskipTests
# Use an OpenJDK image to run the JAR # Use a JDK image to run the JAR
FROM openjdk:22-jdk-slim FROM eclipse-temurin:21-jdk-alpine
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
# Copy the JAR file from the build stage # Copy the JAR file from the build stage
COPY --from=build /app/target/munera-1.0-SNAPSHOT.jar /app/munera-1.0-SNAPSHOT.jar COPY --from=build /app/target/munera-1.0-SNAPSHOT.jar ./munera-1.0-SNAPSHOT.jar
# Expose the port the app runs on # Expose the port the app runs on
EXPOSE 8080 EXPOSE 8080