-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile
102 lines (75 loc) · 2.69 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
91
92
93
94
95
96
97
98
99
100
101
102
FROM debian:buster-slim as build
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${APT_PROXY_HOST}:${APT_PROXY_PORT}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
build-essential \
python3 python3-dev python3-pip python3-venv python3-setuptools \
espeak libsndfile1 git \
llvm-7-dev libatlas-base-dev libopenblas-dev gfortran \
ca-certificates
ENV LLVM_CONFIG=/usr/bin/llvm-config-7
COPY source/ /source/
RUN mkdir -p /app && \
cd /app && \
if [ -f '/source/TTS.tar.gz' ]; then \
tar -C /app -xf /source/TTS.tar.gz; \
else \
git clone https://github.com/mozilla/TTS; \
fi
ENV VENV=/app/venv
RUN python3 -m venv ${VENV}
# IFDEF PROXY
#! ENV PIP_INDEX_URL=http://${PYPI_PROXY_HOST}:${PYPI_PROXY_PORT}/simple/
#! ENV PIP_TRUSTED_HOST=${PYPI_PROXY_HOST}
# ENDIF
# Set up Python virtual environment
RUN ${VENV}/bin/pip3 install --upgrade pip && \
${VENV}/bin/pip3 install --upgrade wheel setuptools
# Target architecture
ARG TARGETARCH
ARG TARGETVARIANT
# Copy shared and architecture-specific files
COPY download/shared/ /download/
COPY download/${TARGETARCH}${TARGETVARIANT}/ /download/
# IFDEF NOAVX
#! RUN mv download/noavx/* download/
# ENDIF
# Install torch from local cache if present
RUN ${VENV}/bin/pip3 install -f /download --no-index --no-deps 'torch==1.6.0' || true
# Install the rest of the requirements
RUN cd /app/TTS && \
if [ -f /download/requirements.txt ]; then cp /download/requirements.txt . ; fi && \
${VENV}/bin/pip3 install -f /download -r requirements.txt
# Install MozillaTTS itself
RUN cd /app/TTS && \
${VENV}/bin/python3 setup.py install
# Packages needed for web server
RUN ${VENV}/bin/pip3 install -f download/ 'quart' 'quart-cors'
# -----------------------------------------------------------------------------
FROM debian:buster-slim
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${APT_PROXY_HOST}:${APT_PROXY_PORT}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
python3 python3-distutils python3-llvmlite libpython3.7 \
espeak libsndfile1 git \
espeak \
libsndfile1 libgomp1 libatlas3-base libgfortran4 libopenblas-base \
libjbig0 liblcms2-2 libopenjp2-7 libtiff5 libwebp6 libwebpdemux2 libwebpmux3 \
libnuma1
# IFDEF PROXY
#! RUN rm -f /etc/apt/apt.conf.d/01proxy
# ENDIF
COPY --from=build /app/venv/ /app/
ARG LANGUAGE=en
COPY model/${LANGUAGE}/ /app/model/
COPY tts_web/ /app/tts_web/
COPY run.sh /
WORKDIR /app
EXPOSE 5002
ENTRYPOINT ["/bin/bash", "/run.sh"]