This commit is contained in:
Patrick Jentsch 2020-04-17 16:00:49 +02:00
parent 926ded985a
commit 343e9157dc
3 changed files with 35 additions and 37 deletions

View File

@ -1,40 +1,35 @@
FROM debian:10-slim
LABEL maintainer="inf_sfb1288@lists.uni-bielefeld.de"
ENV LANG=C.UTF-8
ENV PLATFORM=linux-64
ENV SITE=standard
EXPOSE 4877
RUN apt-get update && \
apt-get install -y --no-install-recommends \
subversion \
bison flex gcc make pkg-config libncurses5 libncurses5-dev libpcre3-dev libglib2.0-0 libglib2.0-dev libreadline7 libreadline-dev
subversion
WORKDIR /root
# Installation: IMS Open Corpus Workbench
RUN svn -q export http://svn.code.sf.net/p/cwb/code/cwb/trunk cwb \
RUN apt-get install -y --no-install-recommends \
autoconf bison flex gcc make pkg-config libc6-dev libncurses5 libncurses5-dev libpcre3-dev libglib2.0-0 libglib2.0-dev libreadline7 libreadline-dev \
&& svn co http://svn.code.sf.net/p/cwb/code/cwb/trunk cwb \
&& cd cwb \
&& make clean \
&& make depend \
&& make all \
&& make install \
&& make realclean \
&& cd .. \
&& rm -r cwb
# Installation: Perl CWB package
RUN echo "yes" | cpan HTML::Entities \
&& svn -q export http://svn.code.sf.net/p/cwb/code/perl/trunk/CWB perl-cwb \
RUN yes | cpan HTML::Entities \
&& svn co http://svn.code.sf.net/p/cwb/code/perl/trunk/CWB perl-cwb \
&& cd perl-cwb \
&& perl Makefile.PL \
&& make \
@ -43,8 +38,9 @@ RUN echo "yes" | cpan HTML::Entities \
&& cd .. \
&& rm -r perl-cwb
# Cleanup
RUN rm -r /var/lib/apt/lists/*
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

View File

@ -1,33 +1,33 @@
#!/bin/bash
if [ $# -eq 0 ]; then
if [ "${1}" == "build-corpus" ]; then
# Input:
# - Source file: "/root/files/corpus.vrt"
# Output
# - Corpus name: "CORPUS"
# - Corpus data directory: "/corpora/data/corpus"
# - Corpus registry file: "/usr/local/share/cwb/registry/corpus"
mkdir -p /corpora/data/corpus
cwb-encode \
-c utf8 \
-d /corpora/data/corpus \
-f /root/files/corpus.vrt \
-R /usr/local/share/cwb/registry/corpus \
-P lemma -P simple_pos -P pos -P ner \
-S text:0+address+author+booktitle+chapter+editor+institution+journal+pages+publisher+publishing_year+school+title -S s \
-0 corpus \
-xsB
cwb-make \
-V CORPUS
elif [ "${1}" == "cqpserver" ]; then
CQPSERVER_HOST="${CQPSERVER_HOST:-*}"
CQPSERVER_PASSWORD="${CQPSERVER_PASSWORD:-}"
CQPSERVER_USER="${CQPSERVER_USER:-anonymous}"
echo "host ${CQPSERVER_HOST};" > /root/cqpserver.init
echo "user ${CQPSERVER_USER} \"${CQPSERVER_PASSWORD}\";" >> /root/cqpserver.init
echo "host ${CQPSERVER_HOST};" > cqpserver.init
echo "user ${CQPSERVER_USER} \"${CQPSERVER_PASSWORD}\";" >> cqpserver.init
cqpserver -I /root/cqpserver.init
elif [ $1 == "prepare" ]; then
# Input:
# - Source file: "/root/files/corpus.vrt"
# Output
# - Corpus name: "CORPUS"
# - Corpus data directory: "/corpora/data/corpus"
# - Corpus registry file: "/usr/local/share/cwb/registry/corpus"
mkdir -p /corpora/data/corpus
cwb-encode \
-c utf8 \
-d /corpora/data/corpus \
-f /root/files/corpus.vrt \
-R /usr/local/share/cwb/registry/corpus \
-P lemma -P simple_pos -P pos -P ner \
-S text:0+address+author+booktitle+chapter+editor+institution+journal+pages+publisher+publishing_year+school+title -S s \
-0 corpus \
-xsB
cwb-make \
-V CORPUS
cqpserver -I cqpserver.init "${@:2}"
else
echo "Unknown command"
echo "Usage: ${0} {build-corpus|cqpserver [OPTION]...}"
fi

View File

@ -2,6 +2,8 @@ version: '3'
services:
cqpserver:
command:
- "cqpserver"
build: ./build/cqpserver
env_file: ./env_files/cqpserver.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/cqpserver:latest