250 lines
7.7 KiB
XML
250 lines
7.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
|
https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<parent>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-parent</artifactId>
|
|
<version>4.0.5</version>
|
|
<relativePath/>
|
|
</parent>
|
|
|
|
<groupId>com.aiteacher</groupId>
|
|
<artifactId>ai-teacher-backend</artifactId>
|
|
<version>0.0.1-SNAPSHOT</version>
|
|
<name>ai-teacher-backend</name>
|
|
<description>Neurosurgeon RAG Learning Platform — Backend</description>
|
|
|
|
<properties>
|
|
<java.version>25</java.version>
|
|
<spring-ai.version>2.0.0-M4</spring-ai.version>
|
|
</properties>
|
|
|
|
<dependencyManagement>
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-bom</artifactId>
|
|
<version>${spring-ai.version}</version>
|
|
<type>pom</type>
|
|
<scope>import</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>software.amazon.awssdk</groupId>
|
|
<artifactId>bom</artifactId>
|
|
<version>2.30.14</version>
|
|
<type>pom</type>
|
|
<scope>import</scope>
|
|
</dependency>
|
|
</dependencies>
|
|
</dependencyManagement>
|
|
|
|
<dependencies>
|
|
<!-- Spring Boot Web -->
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-web</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring Security (HTTP Basic) -->
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-security</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring Data JPA -->
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Flyway -->
|
|
<dependency>
|
|
<groupId>org.flywaydb</groupId>
|
|
<artifactId>flyway-core</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.flywaydb</groupId>
|
|
<artifactId>flyway-database-postgresql</artifactId>
|
|
</dependency>
|
|
|
|
<!-- PostgreSQL JDBC driver -->
|
|
<dependency>
|
|
<groupId>org.postgresql</groupId>
|
|
<artifactId>postgresql</artifactId>
|
|
<scope>runtime</scope>
|
|
</dependency>
|
|
|
|
<!-- Spring AI — pgvector vector store -->
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-starter-vector-store-pgvector</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring AI — OpenAI starter (embedding + chat model autoconfigure) -->
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-starter-model-openai</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring AI — ChatClient fluent API -->
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-client-chat</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring AI — QuestionAnswerAdvisor (RAG) -->
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-advisors-vector-store</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Spring AI — PDF document reader (includes PDFBox transitively) -->
|
|
<dependency>
|
|
<groupId>org.springframework.ai</groupId>
|
|
<artifactId>spring-ai-pdf-document-reader</artifactId>
|
|
</dependency>
|
|
|
|
<!-- PDFBox — page rendering and cropping for figure extraction -->
|
|
<dependency>
|
|
<groupId>org.apache.pdfbox</groupId>
|
|
<artifactId>pdfbox</artifactId>
|
|
<version>3.0.3</version>
|
|
</dependency>
|
|
|
|
<!-- AWS SDK v2 — S3 figure storage -->
|
|
<dependency>
|
|
<groupId>software.amazon.awssdk</groupId>
|
|
<artifactId>s3</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Jackson (JSON) -->
|
|
<dependency>
|
|
<groupId>com.fasterxml.jackson.core</groupId>
|
|
<artifactId>jackson-databind</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Testing -->
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-test</artifactId>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.security</groupId>
|
|
<artifactId>spring-security-test</artifactId>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.graalvm.buildtools</groupId>
|
|
<artifactId>native-maven-plugin</artifactId>
|
|
</plugin>
|
|
|
|
<plugin>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
</plugin>
|
|
|
|
<!-- Jib — package native executable (or fat-jar) into Docker image -->
|
|
<plugin>
|
|
<groupId>com.google.cloud.tools</groupId>
|
|
<artifactId>jib-maven-plugin</artifactId>
|
|
<version>3.5.1</version>
|
|
<configuration>
|
|
<from>
|
|
<!-- distroless glibc base — includes libz + libssl needed by GraalVM native binary -->
|
|
<image>gcr.io/distroless/base-debian12</image>
|
|
</from>
|
|
<to>
|
|
<image>zot.immich-ad.ovh/ai-teacher-backend</image>
|
|
<tags>
|
|
<tag>latest</tag>
|
|
</tags>
|
|
</to>
|
|
<container>
|
|
<format>OCI</format>
|
|
<ports>
|
|
<port>8080</port>
|
|
</ports>
|
|
<!-- invoke the native binary directly — no JVM -->
|
|
<entrypoint>
|
|
<arg>/app/ai-teacher-backend</arg>
|
|
</entrypoint>
|
|
</container>
|
|
<!-- copy the GraalVM-compiled binary from target/ into /app/ -->
|
|
<extraDirectories>
|
|
<paths>
|
|
<path>
|
|
<from>${project.build.directory}</from>
|
|
<into>/app</into>
|
|
<includes>ai-teacher-backend</includes>
|
|
</path>
|
|
</paths>
|
|
<permissions>
|
|
<permission>
|
|
<file>/app/ai-teacher-backend</file>
|
|
<mode>755</mode>
|
|
</permission>
|
|
</permissions>
|
|
</extraDirectories>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
|
|
<profiles>
|
|
<profile>
|
|
<id>native</id>
|
|
<build>
|
|
<plugins>
|
|
|
|
<!-- GraalVM native-image compilation -->
|
|
<plugin>
|
|
<groupId>org.graalvm.buildtools</groupId>
|
|
<artifactId>native-maven-plugin</artifactId>
|
|
<version>1.0.0</version>
|
|
<executions>
|
|
<execution>
|
|
<id>add-reachability-metadata</id>
|
|
<goals>
|
|
<goal>add-reachability-metadata</goal>
|
|
</goals>
|
|
</execution>
|
|
<execution>
|
|
<id>compile</id>
|
|
<goals>
|
|
<goal>compile-no-fork</goal>
|
|
</goals>
|
|
<phase>package</phase>
|
|
</execution>
|
|
</executions>
|
|
<configuration>
|
|
<imageName>ai-teacher-backend</imageName>
|
|
<buildArgs>
|
|
<buildArg>--initialize-at-build-time=org.slf4j,ch.qos.logback</buildArg>
|
|
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
|
|
<buildArg>--gc=serial</buildArg>
|
|
<buildArg>-Os</buildArg>
|
|
<buildArg>-H:+RemoveUnusedSymbols</buildArg>
|
|
<buildArg>-H:-EnableLoggingFeature</buildArg>
|
|
<buildArg>-R:MaxHeapSize=128m</buildArg>
|
|
<buildArg>-R:MinHeapSize=32m</buildArg>
|
|
<!-- Limit native-image compiler RAM (build time, not runtime) -->
|
|
<buildArg>-J-Xmx8g</buildArg>
|
|
</buildArgs>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
</profiles>
|
|
|
|
</project>
|