-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (52 loc) · 2.64 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
FROM nvidia/cuda:12.3.2-base-ubuntu22.04
LABEL org.opencontainers.image.authors="Maarten van Gompel <proycon@anaproy.nl>"
LABEL description="Speaker diarisation service, powered by PyAnnote"
ENV UWSGI_PROCESSES=2
ENV UWSGI_THREADS=2
# 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!
ENV HF_TOKEN=""
#^-- Set to your huggingface token
# Install all global dependencies
RUN apt-get update && apt-get install -y --no-install-recommends runit curl ca-certificates nginx uwsgi uwsgi-plugin-python3 python3-pip python3-yaml python3-lxml python3-requests ffmpeg zip git
# Prepare environment
RUN mkdir -p /etc/service/nginx /etc/service/uwsgi /var/www/.cache /var/www/.config && chown www-data:www-data /var/www/.cache /var/www/.config
# Patch to set proper mimetype for CLAM's logs; maximum upload size
RUN sed -i 's/txt;/txt log rttm;/' /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
ENV XDG_CACHE_DIR=/var/www/.cache
ENV XDG_CONFIG_DIR=/var/www/.cache
ENV TRANSFORMERS_CACHE=/var/www/.cache
ENV HF_HOME=/var/www/.cache
# 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/diarisationservice/diarisationservice.wsgi /etc/diarisationservice.wsgi &&\
chmod a+x /etc/diarisationservice.wsgi &&\
cp -f /usr/src/webservice/diarisationservice.nginx.conf /etc/nginx/sites-enabled/default
# Install the the service itself
RUN cd /usr/src/webservice && pip install . && rm -Rf /usr/src/webservice /root/.cache
RUN ln -s /usr/local/lib/python3.*/dist-packages/clam /opt/clam
VOLUME ["/data"]
EXPOSE 80
WORKDIR /
ENV HOME=/var/www
ENTRYPOINT ["runsvdir","-P","/etc/service"]