Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 1 | FROM alpine:latest AS derekovecs |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 2 | |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 3 | RUN 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 | |
| 15 | RUN curl -fsSL https://raw.githubusercontent.com/kupietz/cpm/main/cpm > /bin/cpm && chmod a+x /bin/cpm |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 16 | |
| 17 | WORKDIR /derekovecs |
| 18 | |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 19 | RUN git config --global user.email "korap+docker@ids-mannheim.de" && \ |
| 20 | git config --global user.name "Docker" |
| 21 | |
| 22 | # Install RocksDB |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 23 | RUN 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 Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 32 | |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 33 | RUN cd /derekovecs && \ |
| 34 | rm -rf rocksdb |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 35 | |
| 36 | # Install collocatordb |
| 37 | RUN 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 Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 43 | make install |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 44 | |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 45 | RUN cd /derekovecs && \ |
| 46 | rm -rf collocatordb |
| 47 | |
| 48 | COPY . . |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 49 | |
| 50 | # Install dependencies |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 51 | RUN cpm install -g https://github.com/Akron/Mojolicious-Plugin-Localize.git && \ |
| 52 | cpm install -g |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 53 | |
| 54 | # Build derekovecs |
| 55 | RUN perl Makefile.PL && \ |
| 56 | make && \ |
| 57 | make install |
| 58 | |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 59 | # RUN MOJO_CONFIG=/derekovecs/example.conf hypnotoad -t script/derekovecs-server # Just do the Inlined::C stuff |
| 60 | # does not work with slimming |
Marc Kupietz | 10ccb98 | 2024-09-12 14:15:13 +0200 | [diff] [blame^] | 61 | RUN perl -p -i -e 's@"/example-models@"/derekovecs/example-models@' example-models/example-docker.conf |
| 62 | RUN rm -rf example-models |
| 63 | RUN rm -rf /root/.perl-cpm |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 64 | RUN rm /bin/cpm && \ |
| 65 | apk del git \ |
| 66 | # g++ \ |
| 67 | cmake \ |
| 68 | curl && \ |
| 69 | rm -rf /root/.cpanm \ |
| 70 | /usr/local/share/man |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 71 | |
Marc Kupietz | a1f9702 | 2022-06-10 23:42:01 +0200 | [diff] [blame] | 72 | ENV MOJO_CONFIG=/config/derekovecs.conf |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 73 | |
| 74 | EXPOSE 3000 |
| 75 | |
| 76 | ENTRYPOINT [ "hypnotoad", "-f", "script/derekovecs-server" ] |