blob: cb329c2418c4e0098443403fbd8b1b74afb7d206 [file] [log] [blame]
Marc Kupietz846e1492024-09-11 19:10:31 +02001FROM alpine:latest AS derekovecs
Marc Kupietza3774412022-06-10 21:46:22 +02002
Marc Kupietz846e1492024-09-11 19:10:31 +02003RUN apk update && \
4 apk add --no-cache git \
5 perl \
6 perl-io-socket-ssl \
7 perl-dev \
8 perl-inline-c \
9 g++ \
10 make \
11 cmake gflags-dev snappy-dev zlib-dev zstd-dev lz4-dev bzip2-dev linux-headers \
12 curl && \
13 set -o pipefail
14
15RUN curl -fsSL https://raw.githubusercontent.com/kupietz/cpm/main/cpm > /bin/cpm && chmod a+x /bin/cpm
Marc Kupietza3774412022-06-10 21:46:22 +020016
17WORKDIR /derekovecs
18
Marc Kupietza3774412022-06-10 21:46:22 +020019RUN git config --global user.email "korap+docker@ids-mannheim.de" && \
20 git config --global user.name "Docker"
21
22# Install RocksDB
Marc Kupietz846e1492024-09-11 19:10:31 +020023RUN export PROCS=$(nproc) && \
24 git clone https://github.com/kupietz/rocksdb.git -b 5.11.fb --single-branch && \
25 cd rocksdb && \
26 mkdir -p build && \
27 cd build && \
28 cmake .. -DWITH_SNAPPY=1 -DWITH_LZ4=1 -DWITH_ZLIB=1 -DWITH_GFLAGS=1 && \
29 make -j $PROCS && \
30 make install && \
31 ln -s /usr/lib/librocksdb.so.5.11.4 /usr/lib/librocksdb.so.5.11
Marc Kupietza3774412022-06-10 21:46:22 +020032
Marc Kupietz846e1492024-09-11 19:10:31 +020033RUN cd /derekovecs && \
34 rm -rf rocksdb
Marc Kupietza3774412022-06-10 21:46:22 +020035
36# Install collocatordb
37RUN git clone "https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb" && \
38 cd collocatordb && \
39 mkdir -p build && \
40 cd build && \
41 cmake .. && \
42 make && \
Marc Kupietz846e1492024-09-11 19:10:31 +020043 make install
Marc Kupietza3774412022-06-10 21:46:22 +020044
Marc Kupietz846e1492024-09-11 19:10:31 +020045RUN cd /derekovecs && \
46 rm -rf collocatordb
47
48COPY . .
Marc Kupietza3774412022-06-10 21:46:22 +020049
50# Install dependencies
Marc Kupietz846e1492024-09-11 19:10:31 +020051RUN cpm install -g https://github.com/Akron/Mojolicious-Plugin-Localize.git && \
52 cpm install -g
Marc Kupietza3774412022-06-10 21:46:22 +020053
54# Build derekovecs
55RUN perl Makefile.PL && \
56 make && \
57 make install
58
Marc Kupietz846e1492024-09-11 19:10:31 +020059# RUN MOJO_CONFIG=/derekovecs/example.conf hypnotoad -t script/derekovecs-server # Just do the Inlined::C stuff
60# does not work with slimming
Marc Kupietz10ccb982024-09-12 14:15:13 +020061RUN perl -p -i -e 's@"/example-models@"/derekovecs/example-models@' example-models/example-docker.conf
62RUN rm -rf example-models
63RUN rm -rf /root/.perl-cpm
Marc Kupietz846e1492024-09-11 19:10:31 +020064RUN rm /bin/cpm && \
65 apk del git \
66# g++ \
67 cmake \
68 curl && \
69 rm -rf /root/.cpanm \
70 /usr/local/share/man
Marc Kupietza3774412022-06-10 21:46:22 +020071
Marc Kupietza1f97022022-06-10 23:42:01 +020072ENV MOJO_CONFIG=/config/derekovecs.conf
Marc Kupietza3774412022-06-10 21:46:22 +020073
74EXPOSE 3000
75
76ENTRYPOINT [ "hypnotoad", "-f", "script/derekovecs-server" ]