blob: 2d9b28bc92e8c8890b65be0a07f8e5f40c812170 [file] [log] [blame]
FROM alpine:latest AS derekovecs
RUN apk update && \
apk add --no-cache git \
perl \
perl-io-socket-ssl \
perl-dev \
perl-inline-c \
g++ \
make \
cmake rocksdb-dev gflags-dev snappy-dev zlib-dev zstd-dev lz4-dev bzip2-dev linux-headers \
curl && \
set -o pipefail
RUN curl -fsSL https://raw.githubusercontent.com/kupietz/cpm/main/cpm > /bin/cpm && chmod a+x /bin/cpm
WORKDIR /derekovecs
RUN git config --global user.email "korap+docker@ids-mannheim.de" && \
git config --global user.name "Docker"
# Install collocatordb, which builds against the rocksdb package
RUN git clone "https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb" && \
cd collocatordb && \
mkdir -p build && \
cd build && \
cmake .. && \
make -j $(nproc) && \
make install
RUN cd /derekovecs && \
rm -rf collocatordb
COPY . .
# Session::Token, pulled in by Mojolicious::Plugin::Util::RandomString, declares
# the functions of its bundled isaac implementation without prototypes, which
# gcc rejects since it defaults to C23. Build this one with C17, the rest of the
# dependencies compile with the defaults.
RUN PERL_MM_OPT="CCFLAGS=-std=gnu17" cpm install -g Session::Token
# Install dependencies. Devel::CheckLib, which Makefile.PL needs to find
# libcollocatordb, comes bundled in inc/
RUN cpm install -g https://github.com/Akron/Mojolicious-Plugin-Localize.git && \
cpm install -g
# Build derekovecs
RUN perl Makefile.PL && \
make && \
make install
# RUN MOJO_CONFIG=/derekovecs/example.conf hypnotoad -t script/derekovecs-server # Just do the Inlined::C stuff
# does not work with slimming
RUN perl -p -i -e 's@"/example-models@"/derekovecs/example-models@' example-models/example-docker.conf
RUN rm -rf example-models
RUN rm -rf /root/.perl-cpm
RUN rm /bin/cpm && \
apk del git \
# g++ \
cmake \
curl && \
rm -rf /root/.cpanm \
/usr/local/share/man
ENV MOJO_CONFIG=/config/derekovecs.conf
EXPOSE 3000
ENTRYPOINT [ "hypnotoad", "-f", "script/derekovecs-server" ]