# Use the official maven image as the base image FROM maven:3.9.6-eclipse-temurin-21 as build # Copy the application code to the container COPY . /app # Set the working directory in the container WORKDIR /app # Build the application RUN mvn clean package -DskipTests # Use the official openjdk image as the base image FROM eclipse-temurin:21-jdk # Set the working directory in the container WORKDIR /app # Copy the built JAR file from the previous stage to the container COPY --from=build /app/target/backend.jar . # Copy the assets folder to the container #COPY ./src/main/java/com/example/demo/DatasetsDB/assets/ /app/assets/ # Set environment variables for Postgres configuration ENV SPRING_DATASOURCE_URL=jdbc:postgresql://db:3333/postgres ENV SPRING_DATASOURCE_USERNAME=postgres ENV SPRING_DATASOURCE_PASSWORD=admin # Expose the port on which the application will run EXPOSE 8080 # Start the application CMD ["java", "-jar", "backend.jar"]