Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 1 | # Use alpine linux as base image |
| 2 | FROM openjdk:8-alpine as builder |
| 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 |
| 36 | RUN cd core && \ |
| 37 | mvn clean install |
| 38 | |
| 39 | # Package lite |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame^] | 40 | RUN cd lite && \ |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 41 | mvn clean package && \ |
| 42 | find target/Kustvakt-lite-*.jar -exec mv {} ../built/Kustvakt-lite.jar ';' |
| 43 | |
| 44 | RUN sed 's!\(krill\.indexDir\s*=\).\+!\1\/kustvakt\/index!' lite/src/main/resources/kustvakt-lite.conf \ |
| 45 | > built/kustvakt-lite.conf |
| 46 | |
| 47 | RUN rm -r core && \ |
| 48 | rm -r full && \ |
| 49 | rm -r lite && \ |
| 50 | rm -r sample-index |
| 51 | |
| 52 | RUN apk del git \ |
| 53 | maven |
| 54 | |
| 55 | RUN cd ${M2_HOME} && rm -r .m2 |
| 56 | |
| 57 | FROM openjdk:8-alpine |
| 58 | |
| 59 | RUN addgroup -S korap && \ |
| 60 | adduser -S kustvakt -G korap && \ |
| 61 | mkdir kustvakt && \ |
| 62 | chown -R kustvakt.korap /kustvakt |
| 63 | |
| 64 | WORKDIR /kustvakt |
| 65 | |
| 66 | COPY --from=builder /kustvakt/built/* /kustvakt/ |
| 67 | |
| 68 | USER kustvakt |
| 69 | |
| 70 | EXPOSE 8089 |
| 71 | |
Akron | 200aec4 | 2022-03-29 12:36:36 +0200 | [diff] [blame^] | 72 | ENTRYPOINT [ "java", "-jar" ] |
| 73 | |
| 74 | CMD [ "Kustvakt-lite.jar" ] |
Akron | 26ddf72 | 2020-08-11 15:39:32 +0200 | [diff] [blame] | 75 | |
| 76 | # TODO: |
| 77 | # - support lite build |
| 78 | # - support full build |