refactor(api): use NightCompress library for reading CBX (#113)

* build: drop unrar from dockerfile

* build: add libarchive to dockerfile

* ci: add libarchive for tests

* build: try adding to the gradle build

* refactor: use nightcompress for reading CBX

* test: disable tests using nightcompress when unavailable

* ci: drop showing java information

* build: add libarchive to dev compose

* build: fix libarchive link in alpine

seems alpine doesn't create libarchive.so and this seems to be the
easiest approach to fix that

* build: use expected order for allowing java to use native libs

* fix: ensure we initialize NightCompress before using it

* fix: properly find input stream

* fix: return amount of data copied

* test: add helper to turn off tests in ArchiveService

* test: rewrite CbxMetadataExtractorTest to mock archiveService

* refactor: expose `Path` to make `CbxMetadataExtractor` easier to test

* test: drop now useless test

* test: add archiveservice to rar5 integration

* test: mock out archiveservice in cbxreader test

* test: use real archiveservice in cbxconverstionintegration

* file: the cbxconversionservicetest also seems to be integration

* test: remove unused imports from cbxmetadataextractortest

* test: cbxcomicinfocompliance is also an integration

* test: cbxmetadatawriter is also integration

* chore: drop unused properties

* test: make cbxmetadataextractortest do something for covers

before it was basically useless because of fallback

* fix: invert check

* chore: better comment

* test: fix more cbxmetadataextractor tests that never worked

* test: we only ever raise ioexception

* fix: handle `null` comicinfo when parsing

* test: properly test for no files comicinfo

* build: manual link of dev docker compose

* test: if you use any matchers, all must be

* build: drop unrar from dev compose

* test: if you use any matchers, all must be

* test: always get a fresh stream

* test: drop more toFile
This commit is contained in:
James Ward
2026-04-22 17:26:59 -04:00
committed by Zach Yale
parent bfeeef268d
commit 1e0b4d0fd5
20 changed files with 763 additions and 2424 deletions
+5 -5
View File
@@ -35,8 +35,6 @@ RUN set -eux; \
jar_path="$(find build/libs -maxdepth 1 -name '*.jar' ! -name '*plain.jar' | head -n 1)"; \
cp "$jar_path" /workspace/booklore-api/app.jar
FROM linuxserver/unrar:7.1.10 AS unrar-layer
FROM mwader/static-ffmpeg:8.1 AS ffprobe-layer
FROM scratch AS kepubify-layer-amd64
@@ -70,13 +68,15 @@ ENV JAVA_TOOL_OPTIONS="-XX:+UseShenandoahGC \
-XX:InitialRAMPercentage=8.0 \
-XX:+ExitOnOutOfMemoryError"
RUN apk add --no-cache su-exec libstdc++ libgcc && \
RUN apk add --no-cache su-exec libstdc++ libgcc libarchive && \
mkdir -p /bookdrop
# Manually link `libarchive.so.13` so java and other libraries can see it
RUN ln -s /usr/lib/libarchive.so.13 /usr/lib/libarchive.so
COPY packaging/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
COPY --from=unrar-layer /usr/bin/unrar-alpine /usr/local/bin/unrar
COPY --from=ffprobe-layer /ffprobe /usr/local/bin/ffprobe
COPY --from=kepubify-layer /kepubify /usr/local/bin/kepubify
@@ -102,4 +102,4 @@ ARG BOOKLORE_PORT=6060
EXPOSE ${BOOKLORE_PORT}
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["java", "-jar", "/app/app.jar"]
CMD ["java", "--enable-native-access=ALL-UNNAMED", "-jar", "/app/app.jar"]