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 |
| 25 | RUN git clone https://github.com/KorAP/Krill.git Krill && \ |
| 26 | cd Krill && \ |
| 27 | git checkout master && \ |
| 28 | mvn clean install |
| 29 | |
| 30 | RUN rm -r Krill |
| 31 | |
| 32 | # Install Kustvakt core |
| 33 | RUN cd core && \ |
| 34 | mvn clean install |
| 35 | |
| 36 | # Package lite |
| 37 | RUN mkdir built && \ |
| 38 | cd lite && \ |
| 39 | mvn clean package && \ |
| 40 | find target/Kustvakt-lite-*.jar -exec mv {} ../built/Kustvakt-lite.jar ';' |
| 41 | |
| 42 | RUN sed 's!\(krill\.indexDir\s*=\).\+!\1\/kustvakt\/index!' lite/src/main/resources/kustvakt-lite.conf \ |
| 43 | > built/kustvakt-lite.conf |
| 44 | |
| 45 | RUN rm -r core && \ |
| 46 | rm -r full && \ |
| 47 | rm -r lite && \ |
| 48 | rm -r sample-index |
| 49 | |
| 50 | RUN apk del git \ |
| 51 | maven |
| 52 | |
| 53 | RUN cd ${M2_HOME} && rm -r .m2 |
| 54 | |
| 55 | FROM openjdk:8-alpine |
| 56 | |
| 57 | RUN addgroup -S korap && \ |
| 58 | adduser -S kustvakt -G korap && \ |
| 59 | mkdir kustvakt && \ |
| 60 | chown -R kustvakt.korap /kustvakt |
| 61 | |
| 62 | WORKDIR /kustvakt |
| 63 | |
| 64 | COPY --from=builder /kustvakt/built/* /kustvakt/ |
| 65 | |
| 66 | USER kustvakt |
| 67 | |
| 68 | EXPOSE 8089 |
| 69 | |
| 70 | CMD ["java", "-jar", "Kustvakt-lite.jar"] |
| 71 | |
| 72 | # TODO: |
| 73 | # - support lite build |
| 74 | # - support full build |