-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (80 loc) · 2.39 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Based on: https://github.com/fau-klue/docker-corpus-tool
FROM ubuntu:jammy as builder
# Install cwb dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends -y \
apt-utils \
autoconf \
bison \
flex \
gcc \
libc6-dev \
libglib2.0-0 \
libglib2.0-dev \
libncurses5 \
libncurses5-dev \
libpcre3-dev \
libreadline8 \
libreadline-dev \
make \
pkg-config \
subversion \
&& rm -rf /var/lib/apt/lists/*
# Download latest cwb source,
# excluding /cwb/doc to keep svn from timing out.
RUN svn checkout -r1557 --depth immediates http://svn.code.sf.net/p/cwb/code/cwb/trunk cwb/
RUN svn update -r1557 --set-depth exclude /cwb/doc
RUN svn update -r1557 --set-depth infinity /cwb/*
# Run install script and Move to unified location
WORKDIR /cwb
RUN ./install-scripts/install-linux
RUN mv /usr/local/cwb-* /usr/local/cwb
###########################################
# Actual Image without build dependencies #
###########################################
FROM ubuntu:jammy
# TODO: investigate if mysql deps are all necessary
# Install dependency libraries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends -y \
bison \
flex \
gawk \
libglib2.0-0 \
libreadline8 \
make \
readline-common \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
git \
gcc \
mysql-server \
libmysqlclient-dev \
subversion \
memcached \
libmemcached-dev \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python
# Add new binaries to PATH
COPY --from=builder /usr/local/cwb /usr/local/cwb
ENV PATH="/usr/local/cwb/bin/:${PATH}"
# TODO: move git and git clone into build step
# Fetch the korp-backend and add our custom config.py
WORKDIR /opt
RUN git clone https://github.com/spraakbanken/korp-backend.git
WORKDIR /opt/korp-backend
RUN git checkout 65e759199464a26b512608cde2e52e62a5989351
RUN pip3 install wheel
RUN pip3 install -r requirements.txt
RUN pip3 install --upgrade Werkzeug==2.2.2 # PD: Necessary downgrade after Werkzeug 3.0.0 came.
COPY config.py /opt/korp-backend/config.py
# Set up a new Mysql DB
COPY db_setup.sql ./
RUN service mysql start && \
mysql -uroot -ppassword < ./db_setup.sql
# Start the main process
CMD service mysql start && python3 /opt/korp-backend/korp.py