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 && \ |
Marc Kupietz | 6835bf8 | 2024-11-15 17:26:01 +0100 | [diff] [blame] | 52 | cpm install -g Devel::CheckLib && \ |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 53 | cpm install -g |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 54 | |
| 55 | # Build derekovecs |
| 56 | RUN perl Makefile.PL && \ |
| 57 | make && \ |
| 58 | make install |
| 59 | |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 60 | # RUN MOJO_CONFIG=/derekovecs/example.conf hypnotoad -t script/derekovecs-server # Just do the Inlined::C stuff |
| 61 | # does not work with slimming |
Marc Kupietz | 10ccb98 | 2024-09-12 14:15:13 +0200 | [diff] [blame] | 62 | RUN perl -p -i -e 's@"/example-models@"/derekovecs/example-models@' example-models/example-docker.conf |
| 63 | RUN rm -rf example-models |
| 64 | RUN rm -rf /root/.perl-cpm |
Marc Kupietz | 846e149 | 2024-09-11 19:10:31 +0200 | [diff] [blame] | 65 | RUN rm /bin/cpm && \ |
| 66 | apk del git \ |
| 67 | # g++ \ |
| 68 | cmake \ |
| 69 | curl && \ |
| 70 | rm -rf /root/.cpanm \ |
| 71 | /usr/local/share/man |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 72 | |
Marc Kupietz | a1f9702 | 2022-06-10 23:42:01 +0200 | [diff] [blame] | 73 | ENV MOJO_CONFIG=/config/derekovecs.conf |
Marc Kupietz | a377441 | 2022-06-10 21:46:22 +0200 | [diff] [blame] | 74 | |
| 75 | EXPOSE 3000 |
| 76 | |
| 77 | ENTRYPOINT [ "hypnotoad", "-f", "script/derekovecs-server" ] |