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