-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (57 loc) · 2.86 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
FROM proycon/ucto
LABEL org.opencontainers.image.authors="Maarten van Gompel <proycon@anaproy.nl>"
LABEL description="Ucto webservice - rule-based tokenizer for multiple languages"
ENV UWSGI_UID=100
ENV UWSGI_GID=100
ENV UWSGI_PROCESSES=2
ENV UWSGI_THREADS=2
# By default, data from the webservice will be stored on the mount you provide
ENV CLAM_ROOT=/data/ucto
ENV CLAM_PORT=80
# (set to true or false, enable this if you run behind a properly configured reverse proxy only)
ENV CLAM_USE_FORWARDED_HOST=false
# Set this for interoperability with the CLARIN Switchboard
ENV CLAM_SWITCHBOARD_FORWARD_URL=""
# By default, there is no authentication on the service,
# which is most likely not what you want if you aim to
# deploy this in a production environment.
# You can connect your own Oauth2/OpenID Connect authorization by setting the following environment parameters:
ENV CLAM_OAUTH=false
#^-- set to true to enable
ENV CLAM_OAUTH_AUTH_URL=""
#^-- example for clariah: https://authentication.clariah.nl/Saml2/OIDC/authorization
ENV CLAM_OAUTH_TOKEN_URL=""
#^-- example for clariah https://authentication.clariah.nl/OIDC/token
ENV CLAM_OAUTH_USERINFO_URL=""
#^--- example for clariah: https://authentication.clariah.nl/OIDC/userinfo
ENV CLAM_OAUTH_CLIENT_ID=""
ENV CLAM_OAUTH_CLIENT_SECRET=""
#^-- always keep this private!
#Set to 1 to enable development version of CLAM
ARG CLAM_DEV=0
# Install all global dependencies
RUN apk update && apk add git runit curl ca-certificates nginx uwsgi uwsgi-python3 py3-pip py3-yaml py3-lxml py3-requests py3-numpy py3-wheel zip
# Prepare environment
RUN mkdir -p /etc/service/nginx /etc/service/uwsgi
# Patch to set proper mimetype for CLAM's logs; maximum upload size
RUN sed -i 's/txt;/txt log;/' /etc/nginx/mime.types &&\
sed -i 's/xml;/xml xsl;/' /etc/nginx/mime.types &&\
sed -i 's/client_max_body_size 1m;/client_max_body_size 1000M;/' /etc/nginx/nginx.conf
# Temporarily add the sources of this webservice
COPY . /usr/src/webservice
# Configure webserver and uwsgi server
RUN cp /usr/src/webservice/runit.d/nginx.run.sh /etc/service/nginx/run &&\
chmod a+x /etc/service/nginx/run &&\
cp /usr/src/webservice/runit.d/uwsgi.run.sh /etc/service/uwsgi/run &&\
chmod a+x /etc/service/uwsgi/run &&\
cp /usr/src/webservice/ucto_webservice/ucto_webservice.wsgi /etc/ucto_webservice.wsgi &&\
chmod a+x /etc/ucto_webservice.wsgi &&\
cp -f /usr/src/webservice/ucto_webservice.nginx.conf /etc/nginx/http.d/default.conf
# Install the service itself (and foliatools for FoLiA XML visualisation)
RUN if [ $CLAM_DEV -eq 1 ]; then pip install --break-system-packages git+https://github.com/proycon/clam.git; fi &&\
cd /usr/src/webservice && pip install --break-system-packages . && rm -Rf /usr/src/webservice &&\
ln -s /usr/lib/python3.*/site-packages/clam /opt/clam
VOLUME ["/data"]
EXPOSE 80
WORKDIR /
ENTRYPOINT ["runsvdir","-P","/etc/service"]