blob: 68d67b2c1f8dae9141c42e383eef3dabc2459153 [file] [log] [blame]
Akron26ddf722020-08-11 15:39:32 +02001# Use alpine linux as base image
Marc Kupietzaf06c462022-11-17 17:25:35 +01002FROM openjdk:19-alpine as builder
Akron26ddf722020-08-11 15:39:32 +02003
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
Marc Kupietzaf06c462022-11-17 17:25:35 +010036RUN mvn -f core/pom.xml clean install
Akron26ddf722020-08-11 15:39:32 +020037
38# Package lite
Akron200aec42022-03-29 12:36:36 +020039RUN cd lite && \
Akron26ddf722020-08-11 15:39:32 +020040 mvn clean package && \
41 find target/Kustvakt-lite-*.jar -exec mv {} ../built/Kustvakt-lite.jar ';'
42
43RUN sed 's!\(krill\.indexDir\s*=\).\+!\1\/kustvakt\/index!' lite/src/main/resources/kustvakt-lite.conf \
44 > built/kustvakt-lite.conf
45
46RUN rm -r core && \
47 rm -r full && \
48 rm -r lite && \
49 rm -r sample-index
50
51RUN apk del git \
52 maven
53
54RUN cd ${M2_HOME} && rm -r .m2
55
Marc Kupietzaf06c462022-11-17 17:25:35 +010056FROM openjdk:19-alpine
Akron26ddf722020-08-11 15:39:32 +020057
58RUN addgroup -S korap && \
59 adduser -S kustvakt -G korap && \
60 mkdir kustvakt && \
61 chown -R kustvakt.korap /kustvakt
62
63WORKDIR /kustvakt
64
65COPY --from=builder /kustvakt/built/* /kustvakt/
66
67USER kustvakt
68
69EXPOSE 8089
70
Akron200aec42022-03-29 12:36:36 +020071ENTRYPOINT [ "java", "-jar" ]
72
73CMD [ "Kustvakt-lite.jar" ]
Akron26ddf722020-08-11 15:39:32 +020074
75# TODO:
76# - support lite build
77# - support full build