blob: 54720ef316e24f643632d915dcfe1d97678608c7 [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 && \
Marc Kupietz6835bf82024-11-15 17:26:01 +010052 cpm install -g Devel::CheckLib && \
Marc Kupietz846e1492024-09-11 19:10:31 +020053 cpm install -g
Marc Kupietza3774412022-06-10 21:46:22 +020054
55# Build derekovecs
56RUN perl Makefile.PL && \
57 make && \
58 make install
59
Marc Kupietz846e1492024-09-11 19:10:31 +020060# RUN MOJO_CONFIG=/derekovecs/example.conf hypnotoad -t script/derekovecs-server # Just do the Inlined::C stuff
61# does not work with slimming
Marc Kupietz10ccb982024-09-12 14:15:13 +020062RUN perl -p -i -e 's@"/example-models@"/derekovecs/example-models@' example-models/example-docker.conf
63RUN rm -rf example-models
64RUN rm -rf /root/.perl-cpm
Marc Kupietz846e1492024-09-11 19:10:31 +020065RUN rm /bin/cpm && \
66 apk del git \
67# g++ \
68 cmake \
69 curl && \
70 rm -rf /root/.cpanm \
71 /usr/local/share/man
Marc Kupietza3774412022-06-10 21:46:22 +020072
Marc Kupietza1f97022022-06-10 23:42:01 +020073ENV MOJO_CONFIG=/config/derekovecs.conf
Marc Kupietza3774412022-06-10 21:46:22 +020074
75EXPOSE 3000
76
77ENTRYPOINT [ "hypnotoad", "-f", "script/derekovecs-server" ]