blob: cb329c2418c4e0098443403fbd8b1b74afb7d206 [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 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 RocksDB
RUN export PROCS=$(nproc) && \
git clone https://github.com/kupietz/rocksdb.git -b 5.11.fb --single-branch && \
cd rocksdb && \
mkdir -p build && \
cd build && \
cmake .. -DWITH_SNAPPY=1 -DWITH_LZ4=1 -DWITH_ZLIB=1 -DWITH_GFLAGS=1 && \
make -j $PROCS && \
make install && \
ln -s /usr/lib/librocksdb.so.5.11.4 /usr/lib/librocksdb.so.5.11
RUN cd /derekovecs && \
rm -rf rocksdb
# Install collocatordb
RUN git clone "https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb" && \
cd collocatordb && \
mkdir -p build && \
cd build && \
cmake .. && \
make && \
make install
RUN cd /derekovecs && \
rm -rf collocatordb
COPY . .
# Install dependencies
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" ]