Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 1 | # Use alpine linux as base image |
Marc Kupietz | af06c46 | 2022-11-17 17:25:35 +0100 | [diff] [blame] | 2 | FROM openjdk:19-alpine as builder |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 3 | |
| 4 | # Copy repository respecting .dockerignore |
| 5 | COPY . /kustvakt |
| 6 | |
| 7 | WORKDIR /kustvakt |
| 8 | |
| 9 | RUN apk update && \ |
| 10 | apk add --no-cache git \ |
| 11 | maven |
| 12 | |
| 13 | RUN git config --global user.email "korap+docker@ids-mannheim.de" && \ |
| 14 | git config --global user.name "Docker" |
| 15 | |
| 16 | # Install Koral |
| 17 | RUN mkdir Koral && git clone https://github.com/KorAP/Koral.git Koral && \ |
| 18 | cd Koral && \ |
| 19 | git checkout master && \ |
| 20 | mvn clean install |
| 21 | |
| 22 | RUN rm -r Koral |
| 23 | |
| 24 | # Install Krill |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame] | 25 | RUN mkdir built && \ |
| 26 | git clone https://github.com/KorAP/Krill.git Krill && \ |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 27 | cd Krill && \ |
| 28 | git checkout master && \ |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame] | 29 | mvn clean install && \ |
| 30 | mvn -Dmaven.test.skip=true package && \ |
| 31 | mv target/Krill-Indexer.jar /kustvakt/built/Krill-Indexer.jar |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 32 | |
| 33 | RUN rm -r Krill |
| 34 | |
| 35 | # Install Kustvakt core |
Marc Kupietz | af06c46 | 2022-11-17 17:25:35 +0100 | [diff] [blame] | 36 | RUN mvn -f core/pom.xml clean install |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 37 | |
| 38 | # Package lite |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame] | 39 | RUN cd lite && \ |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 40 | mvn clean package && \ |
| 41 | find target/Kustvakt-lite-*.jar -exec mv {} ../built/Kustvakt-lite.jar ';' |
| 42 | |
| 43 | RUN sed 's!\(krill\.indexDir\s*=\).\+!\1\/kustvakt\/index!' lite/src/main/resources/kustvakt-lite.conf \ |
| 44 | > built/kustvakt-lite.conf |
| 45 | |
| 46 | RUN rm -r core && \ |
| 47 | rm -r full && \ |
| 48 | rm -r lite && \ |
| 49 | rm -r sample-index |
| 50 | |
| 51 | RUN apk del git \ |
| 52 | maven |
| 53 | |
| 54 | RUN cd ${M2_HOME} && rm -r .m2 |
| 55 | |
Marc Kupietz | af06c46 | 2022-11-17 17:25:35 +0100 | [diff] [blame] | 56 | FROM openjdk:19-alpine |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 57 | |
| 58 | RUN addgroup -S korap && \ |
| 59 | adduser -S kustvakt -G korap && \ |
| 60 | mkdir kustvakt && \ |
| 61 | chown -R kustvakt.korap /kustvakt |
| 62 | |
| 63 | WORKDIR /kustvakt |
| 64 | |
| 65 | COPY --from=builder /kustvakt/built/* /kustvakt/ |
| 66 | |
| 67 | USER kustvakt |
| 68 | |
| 69 | EXPOSE 8089 |
| 70 | |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame] | 71 | ENTRYPOINT [ "java", "-jar" ] |
| 72 | |
| 73 | CMD [ "Kustvakt-lite.jar" ] |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 74 | |
| 75 | # TODO: |
| 76 | # - support lite build |
| 77 | # - support full build |