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