forked from rhasspy/rhasspy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.appimage
244 lines (198 loc) · 8.55 KB
/
Dockerfile.appimage
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
FROM debian:stretch-slim as build
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
# 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-setuptools python3-venv
ENV NUM_JOBS=8
ENV APP_DIR=/AppDir
# -----------------------------------------------------------------------------
# Python 3.7
# -----------------------------------------------------------------------------
FROM build as python
RUN apt-get install --yes --no-install-recommends \
git zlib1g-dev patchelf rsync
ADD download/source/Python-3.7.8.tgz /build
RUN cd /build/Python-3.7.8 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# -----------------------------------------------------------------------------
# Utilities
# -----------------------------------------------------------------------------
FROM build as utils
# Bash 4.4
ADD download/source/bash-4.4.tar.gz /build/
RUN cd /build/bash-4.4 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Diffutils 3.6
ADD download/source/diffutils-3.6.tar.xz /build/
RUN cd /build/diffutils-3.6 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Gawk 4.2.1
ADD download/source/gawk-4.2.1.tar.gz /build/
RUN cd /build/gawk-4.2.1 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Grep 3.1
ADD download/source/grep-3.1.tar.xz /build/
RUN cd /build/grep-3.1 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Sed 4.8
ADD download/source/sed-4.8.tar.gz /build/
RUN cd /build/sed-4.8 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Util-Linux 2.31.1
ADD download/source/util-linux-2.31.1.tar.gz /build/
RUN cd /build/util-linux-2.31.1 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Coreutils 8.28
RUN apt-get install --yes --no-install-recommends \
libgmp-dev git rsync automake autoconf \
bison autopoint texinfo gperf gettext
ADD download/source/coreutils-8.28.tar.gz /build/
RUN cd /build/coreutils && \
./bootstrap
RUN cd /build/coreutils && \
FORCE_UNSAFE_CONFIGURE=1 ./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# -----------------------------------------------------------------------------
# Supporting Programs
# -----------------------------------------------------------------------------
FROM build as progs
# Sox 14.4.2
RUN apt-get install --yes --no-install-recommends \
autoconf automake libtool
ADD download/source/sox-14.4.2.tar.gz /build/
RUN cd /build/sox-14.4.2 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Mosquitto 2.0.3
RUN apt-get install --yes --no-install-recommends \
cmake libc-ares-dev libwebsockets-dev libssl-dev
ADD download/source/mosquitto-2.0.3.tar.gz /build/
ADD download/source/cJSON-1.7.14.tar.gz /build/mosquitto-2.0.3/
RUN cd /build/mosquitto-2.0.3 && \
mv cJSON-1.7.14 cjson && \
mkdir -p cjson/build && \
cd cjson/build && \
cmake .. && \
make -j $NUM_JOBS && \
make install && \
make install DESTDIR=$APP_DIR
RUN cd /build/mosquitto-2.0.3 && \
make WITH_DOCS=no -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# Espeak-ng 1.50
ADD download/source/espeak-ng-1.50.tgz /build/
RUN cd /build/espeak-ng && \
./configure && \
make && \
make install DESTDIR=$APP_DIR
# Flite 2.2
ADD download/source/flite-2.2.tar.gz /build/
RUN cd /build/flite-2.2 && \
./configure && \
make -j $NUM_JOBS && \
make install DESTDIR=$APP_DIR
# -----------------------------------------------------------------------------
# Rhasspy
# -----------------------------------------------------------------------------
FROM base as rhasspy
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
python3 python3-dev python3-setuptools python3-pip python3-venv \
build-essential swig portaudio19-dev \
llvm-7-dev libatlas-base-dev libopenblas-dev gfortran \
gfortran libopenblas-dev liblapack-dev cython \
curl ca-certificates
ENV LLVM_CONFIG=/usr/bin/llvm-config-7
ENV APP_DIR=/usr/lib/rhasspy
ENV BUILD_DIR=/build
ARG TARGETARCH
ARG TARGETVARIANT
# Directory of prebuilt tools
COPY download/shared/ ${BUILD_DIR}/download/
COPY download/${TARGETARCH}${TARGETVARIANT}/ ${BUILD_DIR}/download/
# IFDEF NOAVX
#! RUN mv download/noavx/* download/
# ENDIF
# Copy Rhasspy module requirements
COPY rhasspy-server-hermes/requirements.txt ${BUILD_DIR}/rhasspy-server-hermes/
COPY rhasspy-wake-snowboy-hermes/requirements.txt ${BUILD_DIR}/rhasspy-wake-snowboy-hermes/
COPY rhasspy-wake-porcupine-hermes/requirements.txt ${BUILD_DIR}/rhasspy-wake-porcupine-hermes/
COPY rhasspy-wake-precise-hermes/requirements.txt ${BUILD_DIR}/rhasspy-wake-precise-hermes/
COPY rhasspy-profile/requirements.txt ${BUILD_DIR}/rhasspy-profile/
COPY rhasspy-asr/requirements.txt ${BUILD_DIR}/rhasspy-asr/
COPY rhasspy-asr-deepspeech/requirements.txt ${BUILD_DIR}/rhasspy-asr-deepspeech/
COPY rhasspy-asr-deepspeech-hermes/requirements.txt ${BUILD_DIR}/rhasspy-asr-deepspeech-hermes/
COPY rhasspy-asr-pocketsphinx/requirements.txt ${BUILD_DIR}/rhasspy-asr-pocketsphinx/
COPY rhasspy-asr-pocketsphinx-hermes/requirements.txt ${BUILD_DIR}/rhasspy-asr-pocketsphinx-hermes/
COPY rhasspy-asr-kaldi/requirements.txt ${BUILD_DIR}/rhasspy-asr-kaldi/
COPY rhasspy-asr-kaldi-hermes/requirements.txt ${BUILD_DIR}/rhasspy-asr-kaldi-hermes/
COPY rhasspy-dialogue-hermes/requirements.txt ${BUILD_DIR}/rhasspy-dialogue-hermes/
COPY rhasspy-fuzzywuzzy/requirements.txt ${BUILD_DIR}/rhasspy-fuzzywuzzy/
COPY rhasspy-fuzzywuzzy-hermes/requirements.txt ${BUILD_DIR}/rhasspy-fuzzywuzzy-hermes/
COPY rhasspy-hermes/requirements.txt ${BUILD_DIR}/rhasspy-hermes/
COPY rhasspy-homeassistant-hermes/requirements.txt ${BUILD_DIR}/rhasspy-homeassistant-hermes/
COPY rhasspy-microphone-cli-hermes/requirements.txt ${BUILD_DIR}/rhasspy-microphone-cli-hermes/
COPY rhasspy-microphone-pyaudio-hermes/requirements.txt ${BUILD_DIR}/rhasspy-microphone-pyaudio-hermes/
COPY rhasspy-nlu/requirements.txt ${BUILD_DIR}/rhasspy-nlu/
COPY rhasspy-nlu-hermes/requirements.txt ${BUILD_DIR}/rhasspy-nlu-hermes/
COPY rhasspy-rasa-nlu-hermes/requirements.txt ${BUILD_DIR}/rhasspy-rasa-nlu-hermes/
COPY rhasspy-remote-http-hermes/requirements.txt ${BUILD_DIR}/rhasspy-remote-http-hermes/
COPY rhasspy-silence/requirements.txt ${BUILD_DIR}/rhasspy-silence/
COPY rhasspy-snips-nlu/requirements.txt ${BUILD_DIR}/rhasspy-snips-nlu/
COPY rhasspy-snips-nlu/etc/languages/ ${BUILD_DIR}/rhasspy-snips-nlu/etc/languages/
COPY rhasspy-snips-nlu-hermes/requirements.txt ${BUILD_DIR}/rhasspy-snips-nlu-hermes/
COPY rhasspy-speakers-cli-hermes/requirements.txt ${BUILD_DIR}/rhasspy-speakers-cli-hermes/
COPY rhasspy-supervisor/requirements.txt ${BUILD_DIR}/rhasspy-supervisor/
COPY rhasspy-tts-cli-hermes/requirements.txt ${BUILD_DIR}/rhasspy-tts-cli-hermes/
COPY rhasspy-tts-wavenet-hermes/requirements.txt ${BUILD_DIR}/rhasspy-tts-wavenet-hermes/
COPY rhasspy-wake-pocketsphinx-hermes/requirements.txt ${BUILD_DIR}/rhasspy-wake-pocketsphinx-hermes/
COPY rhasspy-wake-raven/requirements.txt ${BUILD_DIR}/rhasspy-wake-raven/
COPY rhasspy-wake-raven-hermes/requirements.txt ${BUILD_DIR}/rhasspy-wake-raven-hermes/
COPY rhasspy-tts-larynx-hermes/requirements.txt ${BUILD_DIR}/rhasspy-tts-larynx-hermes/
COPY rhasspy-tts-larynx-hermes/larynx/ ${BUILD_DIR}/rhasspy-tts-larynx-hermes/larynx/
# Autoconf
COPY m4/ ${BUILD_DIR}/m4/
COPY configure config.sub config.guess \
install-sh missing aclocal.m4 \
Makefile.in setup.py.in rhasspy.sh.in rhasspy.spec.in \
${BUILD_DIR}/
RUN cd ${BUILD_DIR} && \
./configure --enable-in-place --prefix=${APP_DIR}/.venv
COPY scripts/install/ ${BUILD_DIR}/scripts/install/
COPY RHASSPY_DIRS ${BUILD_DIR}/
# IFDEF PROXY
#! ENV PIP_INDEX_URL=http://${PYPI_PROXY_HOST}:${PYPI_PROXY_PORT}/simple/
#! ENV PIP_TRUSTED_HOST=${PYPI_PROXY_HOST}
# ENDIF
RUN export PIP_INSTALL_ARGS="-f ${BUILD_DIR}/download" && \
export PIP_PREINSTALL_PACKAGES='numpy==1.19.0 grpcio==1.30.0 scipy==1.5.1' && \
export POCKETSPHINX_FROM_SRC=no && \
cd ${BUILD_DIR} && \
make && \
make install
RUN cd ${APP_DIR}/.venv && \
find . -type f -name 'g2p.fst.gz' -exec gunzip {} \\;
COPY --from=utils ${APP_DIR}/ ${APP_DIR}/
COPY --from=progs ${APP_DIR}/ ${APP_DIR}/
COPY --from=python ${APP_DIR}/ ${APP_DIR}/