# ─── Build stage ────────────────────────────────────────────────────────────── # eclipse-temurin:21-jdk-jammy ships JDK 21 + Maven-compatible toolchain. # frontend-maven-plugin downloads Node/npm automatically, so no explicit # Node install is needed in the build stage. FROM eclipse-temurin:21-jdk-jammy AS builder RUN apt-get update \ && apt-get install -y --no-install-recommends maven \ && rm -rf /var/lib/apt/lists/* WORKDIR /build COPY . . RUN mvn -q package -DskipTests -T 1C # ─── Runtime stage (CPU-only) ───────────────────────────────────────────────── FROM eclipse-temurin:21-jre-jammy LABEL org.opencontainers.image.title="TrueRef" LABEL org.opencontainers.image.description="Self-hosted documentation retrieval platform for AI coding assistants (CPU variant)" LABEL org.opencontainers.image.url="https://git.sal.giize.com/mozempk/trueref" LABEL org.opencontainers.image.source="https://git.sal.giize.com/mozempk/trueref" WORKDIR /app COPY --from=builder /build/trueref-bootstrap/target/trueref.jar /app/trueref.jar # /data is the default trueref.home: H2 DB, Lucene index, embedding cache and # downloaded models all live here. Mount a volume to persist between restarts. VOLUME /data ENV TRUEREF_HOME=/data \ TRUEREF_PORT=18080 \ JAVA_OPTS="" EXPOSE 18080 # JVM flags required by trueref: # --enable-native-access silences FFM Linker warning from DJL tokenizers # --add-modules enables Lucene 10 SIMD codepath (incubator.vector) # Spring properties are passed via CMD so users can override them at runtime. ENTRYPOINT ["sh", "-c", \ "exec java \ --enable-native-access=ALL-UNNAMED \ --add-modules=jdk.incubator.vector \ ${JAVA_OPTS} \ -jar /app/trueref.jar \ --server.port=${TRUEREF_PORT} \ --trueref.home=${TRUEREF_HOME} \ --trueref.embedding.onnx-providers=cpu \ \"$@\"", "--"]