From c8ddbe440f734c2f46383ebd12d37c2a92ac2bda Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Thu, 11 Apr 2024 08:44:50 +0200 Subject: [PATCH] Simplify docker configuration of MorphoDiTa-based Annotace. Use volumes to pass taggers to Annotace instead of baking them into the image. --- Dockerfile | 2 +- Dockerfile-morphodita | 5 ----- docker-compose-morphodita.yml | 9 ++++----- docker-compose.yml | 1 - 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19e5c27..5b8725b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM gradle:8.0.2-jdk11-alpine as build RUN mkdir annotace WORKDIR /annotace COPY . . -RUN gradle bootJar -Pcore,lemmatizer-spark,keywordextractor-ker +RUN gradle bootJar -x test FROM eclipse-temurin:11-jdk-alpine as runtime COPY --from=build /annotace/core/build/libs/*.jar / diff --git a/Dockerfile-morphodita b/Dockerfile-morphodita index 6ce6240..beaebb9 100644 --- a/Dockerfile-morphodita +++ b/Dockerfile-morphodita @@ -1,15 +1,11 @@ -ARG MORPHODITA_TAGGERS ARG MORPHODITA_ZIP ARG MORPHODITA_ZIP_SO ######################################################################################################################## FROM alpine as unzip -ARG MORPHODITA_TAGGERS ARG MORPHODITA_ZIP -RUN mkdir taggers RUN mkdir morphodita -COPY $MORPHODITA_TAGGERS /taggers COPY $MORPHODITA_ZIP /morphodita WORKDIR /morphodita RUN unzip *.zip @@ -28,7 +24,6 @@ RUN apk add --update --no-cache libc6-compat RUN cp /lib64/ld-linux-x86-64.so.2 /lib/ COPY --from=buildMaven /annotace/core/build/libs/annotace-*.jar / RUN mv *.jar annotace.jar -COPY --from=unzip /taggers . COPY --from=unzip /morphodita/$MORPHODITA_ZIP_SO /lib EXPOSE 8080 diff --git a/docker-compose-morphodita.yml b/docker-compose-morphodita.yml index 594e660..46c2ce5 100644 --- a/docker-compose-morphodita.yml +++ b/docker-compose-morphodita.yml @@ -1,4 +1,3 @@ -version: '3.9' services: annotace: container_name: annotace @@ -11,12 +10,12 @@ services: MORPHODITA_ZIP: lib/morphodita-1.9.2-bin.zip # path to the MorphoDiTa shared library within the $MORPHODITA_ZIP MORPHODITA_ZIP_SO: morphodita-1.9.2-bin/bin-linux64/java/libmorphodita_java.so - # path to a directory containing taggers to use, from https://lindat.mff.cuni.cz/repository/xmlui/handle/11234/1-1836 - MORPHODITA_TAGGERS: lib/tagger-morfflex2 environment: - # List of taggers mapped to individual supported languages (tagger names should correspond to files in $MORPHODITA_TAGGERS) - ANNOTACE_MORPHODITA_TAGGERS_CS: czech-morfflex2.0-pdtc1.0-220710.tagger + # List of taggers mapped to individual supported languages (tagger names should correspond to files in the taggers volume) + ANNOTACE_MORPHODITA_TAGGERS_CS: taggers/czech-morfflex2.0-pdtc1.0-220710.tagger ANNOTACE_LEMMATIZER: morphodita-jni + volumes: + - ./lib/taggers:/taggers ports: - 8888:8080 network_mode: host diff --git a/docker-compose.yml b/docker-compose.yml index 9811a6e..b0eb351 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.9' services: annotace: container_name: annotace