mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/cqpserver.git
synced 2024-12-26 03:14:20 +00:00
Change project structure and update build script
This commit is contained in:
parent
f75cb01029
commit
607046a53a
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
|
data
|
||||||
|
files
|
||||||
|
registry
|
||||||
*.env
|
*.env
|
||||||
volumes
|
|
||||||
|
@ -1,44 +1,71 @@
|
|||||||
image: docker:stable
|
image: docker:19.03.13
|
||||||
|
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay2
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker:19.03.13-dind
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- push
|
- push
|
||||||
|
|
||||||
|
.reg_setup:
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
- apk add --no-cache curl
|
||||||
|
- curl --fail --show-error --location "https://github.com/genuinetools/reg/releases/download/v$REG_VERSION/reg-linux-amd64" --output /usr/local/bin/reg
|
||||||
|
- echo "$REG_SHA256 /usr/local/bin/reg" | sha256sum -c -
|
||||||
|
- chmod a+x /usr/local/bin/reg
|
||||||
|
variables:
|
||||||
|
REG_SHA256: ade837fc5224acd8c34732bf54a94f579b47851cc6a7fd5899a98386b782e228
|
||||||
|
REG_VERSION: 0.16.1
|
||||||
|
|
||||||
Build:
|
build_image:
|
||||||
script:
|
script:
|
||||||
- docker build --pull -t $CI_REGISTRY_IMAGE:tmp build/cqpserver
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
- docker push $CI_REGISTRY_IMAGE:tmp
|
- docker build -t $INTERMEDIATE_IMAGE_TAG .
|
||||||
|
- docker push $INTERMEDIATE_IMAGE_TAG
|
||||||
stage: build
|
stage: build
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
variables:
|
||||||
|
INTERMEDIATE_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
|
||||||
Push latest:
|
push_master:
|
||||||
|
extends:
|
||||||
|
- .reg_setup
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:tmp
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:latest
|
- docker pull $INTERMEDIATE_IMAGE_TAG
|
||||||
- docker push $CI_REGISTRY_IMAGE:latest
|
- /usr/local/bin/reg rm -d --auth-url $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $INTERMEDIATE_IMAGE_TAG
|
||||||
|
- docker tag $INTERMEDIATE_IMAGE_TAG $IMAGE_TAG
|
||||||
|
- docker push $IMAGE_TAG
|
||||||
stage: push
|
stage: push
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
variables:
|
||||||
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
|
||||||
|
INTERMEDIATE_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
|
||||||
Push tag:
|
push_other:
|
||||||
|
extends:
|
||||||
|
- .reg_setup
|
||||||
|
except:
|
||||||
|
- master
|
||||||
only:
|
only:
|
||||||
|
- branches
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:tmp
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
- docker pull $INTERMEDIATE_IMAGE_TAG
|
||||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
- /usr/local/bin/reg rm -d --auth-url $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $INTERMEDIATE_IMAGE_TAG
|
||||||
|
- docker tag $INTERMEDIATE_IMAGE_TAG $IMAGE_TAG
|
||||||
|
- docker push $IMAGE_TAG
|
||||||
stage: push
|
stage: push
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
variables:
|
||||||
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||||
|
INTERMEDIATE_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM debian:10-slim
|
FROM debian:10-slim
|
||||||
|
|
||||||
|
|
||||||
LABEL maintainer="inf_sfb1288@lists.uni-bielefeld.de"
|
LABEL authors="Patrick Jentsch <p.jentsch@uni-bielefeld.de>, Stephan Porada <sporada@uni-bielefeld.de>"
|
||||||
|
|
||||||
|
|
||||||
ARG CWB_REVISION=1499
|
ARG CWB_REVISION=1499
|
||||||
@ -13,18 +13,15 @@ ENV LANG=C.UTF-8
|
|||||||
EXPOSE 4877
|
EXPOSE 4877
|
||||||
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
subversion
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
|
|
||||||
# Installation: IMS Open Corpus Workbench
|
## Install IMS Open Corpus Workbench ##
|
||||||
RUN apt-get install -y --no-install-recommends \
|
RUN apt-get update \
|
||||||
autoconf bison flex gcc make pkg-config libc6-dev libncurses5 libncurses5-dev libpcre3-dev libglib2.0-0 libglib2.0-dev libreadline7 libreadline-dev \
|
&& apt-get install --no-install-recommends --yes \
|
||||||
&& svn checkout http://svn.code.sf.net/p/cwb/code/cwb/trunk@${CWB_REVISION} cwb \
|
subversion autoconf bison flex gcc make pkg-config libc6-dev libncurses5 libncurses5-dev libpcre3-dev libglib2.0-0 libglib2.0-dev libreadline7 libreadline-dev \
|
||||||
|
&& rm -r /var/lib/apt/lists/* \
|
||||||
|
&& svn checkout "http://svn.code.sf.net/p/cwb/code/cwb/trunk@${CWB_REVISION}" cwb \
|
||||||
&& cd cwb \
|
&& cd cwb \
|
||||||
&& make clean PLATFORM=${CWB_PLATFORM} SITE=${CWB_SITE} \
|
&& make clean PLATFORM=${CWB_PLATFORM} SITE=${CWB_SITE} \
|
||||||
&& make depend PLATFORM=${CWB_PLATFORM} SITE=${CWB_SITE} \
|
&& make depend PLATFORM=${CWB_PLATFORM} SITE=${CWB_SITE} \
|
||||||
@ -34,9 +31,10 @@ RUN apt-get install -y --no-install-recommends \
|
|||||||
&& cd .. \
|
&& cd .. \
|
||||||
&& rm -r cwb
|
&& rm -r cwb
|
||||||
|
|
||||||
# Installation: Perl CWB package
|
|
||||||
|
## Installation: Perl CWB package ##
|
||||||
RUN yes | cpan HTML::Entities \
|
RUN yes | cpan HTML::Entities \
|
||||||
&& svn checkout http://svn.code.sf.net/p/cwb/code/perl/trunk/CWB@${CWB_REVISION} perl-cwb \
|
&& svn checkout "http://svn.code.sf.net/p/cwb/code/perl/trunk/CWB@${CWB_REVISION}" perl-cwb \
|
||||||
&& cd perl-cwb \
|
&& cd perl-cwb \
|
||||||
&& perl Makefile.PL \
|
&& perl Makefile.PL \
|
||||||
&& make \
|
&& make \
|
||||||
@ -46,9 +44,6 @@ RUN yes | cpan HTML::Entities \
|
|||||||
&& rm -r perl-cwb
|
&& rm -r perl-cwb
|
||||||
|
|
||||||
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
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 \
|
|
||||||
-xsB -9
|
|
||||||
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};" > cqpserver.init
|
|
||||||
echo "user ${CQPSERVER_USER} \"${CQPSERVER_PASSWORD}\";" >> cqpserver.init
|
|
||||||
|
|
||||||
cqpserver -I cqpserver.init "${@:2}"
|
|
||||||
else
|
|
||||||
echo "Usage: ${0} {build-corpus|cqpserver [OPTION]...}"
|
|
||||||
fi
|
|
@ -1,15 +1,12 @@
|
|||||||
version: '3'
|
version: '3.5'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
cqpserver:
|
cqpserver:
|
||||||
command:
|
env_file: .env
|
||||||
- "cqpserver"
|
|
||||||
build: ./build/cqpserver
|
|
||||||
env_file: ./env_files/cqpserver.env
|
|
||||||
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/cqpserver:latest
|
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/cqpserver:latest
|
||||||
ports:
|
ports:
|
||||||
- 4877:4877
|
- "4877:4877"
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/cqpserver/data:/corpora/data
|
- "${HOST_CQPSERVER_DATA_DIR:-./data}:/corpora/data"
|
||||||
- ./volumes/cqpserver/files:/root/files
|
- "${HOST_CQPSERVER_FILES_DIR:-./files}:/root/files"
|
||||||
- ./volumes/cqpserver/registry:/usr/local/share/cwb/registry
|
- "${HOST_CQPSERVER_REGISTRY_DIR:-./registry}:/usr/local/share/cwb/registry"
|
||||||
|
41
docker-entrypoint.sh
Executable file
41
docker-entrypoint.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ "$#" -eq 0 || "${1}" == "cqpserver" ]]; then
|
||||||
|
CQPSERVER_HOST="${CQPSERVER_HOST:-*}"
|
||||||
|
CQPSERVER_PASSWORD="${CQPSERVER_PASSWORD:-}"
|
||||||
|
CQPSERVER_USER="${CQPSERVER_USER:-anonymous}"
|
||||||
|
echo "host ${CQPSERVER_HOST};" > cqpserver.init
|
||||||
|
echo "user ${CQPSERVER_USER} \"${CQPSERVER_PASSWORD}\";" >> cqpserver.init
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$#" -eq 0 ]]; then
|
||||||
|
cqpserver -I cqpserver.init
|
||||||
|
elif [[ "$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 \
|
||||||
|
-xsB -9
|
||||||
|
cwb-make \
|
||||||
|
-V CORPUS
|
||||||
|
elif [ "${1}" == "cqpserver" ]; then
|
||||||
|
cqpserver -I cqpserver.init "${@:2}"
|
||||||
|
else
|
||||||
|
exec ${@:1}
|
||||||
|
echo "$0 [COMMAND]"
|
||||||
|
echo ""
|
||||||
|
echo "cqpserver startup and corpus build script"
|
||||||
|
echo ""
|
||||||
|
echo "Commands:"
|
||||||
|
echo " build-corpus"
|
||||||
|
echo " cqpserver"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user