Clean up docker file and docker run.sh

This commit is contained in:
Michael Hansen
2020-04-19 11:39:46 -04:00
parent 465d1e61e0
commit 3e9c4bef68
32 changed files with 14 additions and 956 deletions
+14 -6
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
this_dir="$( cd "$( dirname "$0" )" && pwd )"
# Try to detemine where Rhasspy is located
if [[ -z "${RHASSPY_APP}" ]]; then
@@ -16,12 +15,21 @@ if [[ -f "${CONFIG_PATH}" ]]; then
# Hass.IO configuration
profile_name="$(jq --raw-output '.profile_name' "${CONFIG_PATH}")"
profile_dir="$(jq --raw-output '.profile_dir' "${CONFIG_PATH}")"
RHASSPY_ARGS="--profile ${profile_name} --user-profiles ${profile_dir}"
RHASSPY_ARGS=('--profile' "${profile_name}" '--user-profiles' "${profile_dir}")
asoundrc="$(jq --raw-output '.asoundrc' ${CONFIG_PATH})"
# Copy user-defined asoundrc to root
asoundrc="$(jq --raw-output '.asoundrc' "${CONFIG_PATH}")"
if [[ ! -z "${asoundrc}" ]]; then
echo "${asoundrc}" > /root/.asoundrc
fi
# Add SSL settings
ssl="$(jq --raw-output '.ssl' "${CONFIG_PATH}")"
if [[ "${ssl}" == 'true' ]]; then
certfile="$(jq --raw-output '.certfile' "${CONFIG_PATH}")"
keyfile="$(jq --raw-output '.keyfile' "${CONFIG_PATH}")"
RHASSPY_ARGS+=('--ssl' "${certfile}" "${keyfile}")
fi
fi
RHASSPY_VENV="${RHASSPY_APP}/.venv"
@@ -32,10 +40,10 @@ if [[ -d "${RHASSPY_VENV}" ]]; then
export LD_LIBRARY_PATH="${RHASSPY_VENV}/lib:${LD_LIBRARY_PATH}"
fi
cd "${RHASSPY_APP}"
cd "${RHASSPY_APP}" || exit 1
if [[ -z "${RHASSPY_ARGS}" ]]; then
if [[ -z "${RHASSPY_ARGS[*]}" ]]; then
python3 app.py "$@"
else
python3 app.py ${RHASSPY_ARGS} "$@"
python3 app.py "${RHASSPY_ARGS[@]}" "$@"
fi
-52
View File
@@ -1,52 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
QEMU
SYSTEM_DEPENDENCIES
RHASSPY_TOOLS
PYTHON_REQUIREMENTS
PYTHON_POCKETSPHINX
SNOWBOY
TTS
KALDI
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
GSTREAMER
PULSEAUDIO
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
RHASSPY_USER
PROFILES
RHASSPY_CODE
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1 +0,0 @@
COPY profiles/ ${RHASSPY_APP}/profiles/
-1
View File
@@ -1 +0,0 @@
ENV RHASSPY_APP /usr/share/rhasspy
@@ -1,207 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/openfst-1.6.2-1_${BUILD_ARCH}.deb /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then \
apt-get install --no-install-recommends --yes libfst-dev libfst-tools; \
else \
dpkg -i /openfst-1.6.2-1_${BUILD_ARCH}.deb; \
rm /openfst*.deb; \
fi
RHASSPY_TOOLS
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
ENV RHASSPY_APP /usr/share/rhasspy
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
COPY profiles/zh/profile.json \
profiles/zh/custom_words.txt \
profiles/zh/espeak_phonemes.txt \
profiles/zh/phoneme_examples.txt \
profiles/zh/frequent_words.txt \
profiles/zh/sentences.ini \
profiles/zh/stop_words.txt ${RHASSPY_APP}/profiles/zh/
COPY profiles/hi/ \
profiles/hi/profile.json \
profiles/hi/custom_words.txt \
profiles/hi/espeak_phonemes.txt \
profiles/hi/phoneme_examples.txt \
profiles/hi/frequent_words.txt \
profiles/hi/sentences.ini \
profiles/hi/stop_words.txt ${RHASSPY_APP}/profiles/hi/
COPY profiles/el/profile.json \
profiles/el/custom_words.txt \
profiles/el/espeak_phonemes.txt \
profiles/el/phoneme_examples.txt \
profiles/el/frequent_words.txt \
profiles/el/sentences.ini \
profiles/el/stop_words.txt ${RHASSPY_APP}/profiles/el/
COPY profiles/de/profile.json \
profiles/de/custom_words.txt \
profiles/de/espeak_phonemes.txt \
profiles/de/phoneme_examples.txt \
profiles/de/frequent_words.txt \
profiles/de/sentences.ini \
profiles/de/stop_words.txt ${RHASSPY_APP}/profiles/de/
COPY profiles/it/profile.json \
profiles/it/custom_words.txt \
profiles/it/espeak_phonemes.txt \
profiles/it/phoneme_examples.txt \
profiles/it/frequent_words.txt \
profiles/it/sentences.ini \
profiles/it/stop_words.txt ${RHASSPY_APP}/profiles/it/
COPY profiles/es/profile.json \
profiles/es/custom_words.txt \
profiles/es/espeak_phonemes.txt \
profiles/es/phoneme_examples.txt \
profiles/es/frequent_words.txt \
profiles/es/sentences.ini \
profiles/es/stop_words.txt ${RHASSPY_APP}/profiles/es/
COPY profiles/fr/profile.json \
profiles/fr/custom_words.txt \
profiles/fr/espeak_phonemes.txt \
profiles/fr/phoneme_examples.txt \
profiles/fr/frequent_words.txt \
profiles/fr/sentences.ini \
profiles/fr/stop_words.txt ${RHASSPY_APP}/profiles/fr/
COPY profiles/ru/profile.json \
profiles/ru/custom_words.txt \
profiles/ru/espeak_phonemes.txt \
profiles/ru/phoneme_examples.txt \
profiles/ru/frequent_words.txt \
profiles/ru/sentences.ini \
profiles/ru/stop_words.txt ${RHASSPY_APP}/profiles/ru/
COPY profiles/nl/profile.json \
profiles/nl/custom_words.txt \
profiles/nl/espeak_phonemes.txt \
profiles/nl/phoneme_examples.txt \
profiles/nl/frequent_words.txt \
profiles/nl/sentences.ini \
profiles/nl/stop_words.txt ${RHASSPY_APP}/profiles/nl/
COPY profiles/vi/profile.json \
profiles/vi/custom_words.txt \
profiles/vi/espeak_phonemes.txt \
profiles/vi/phoneme_examples.txt \
profiles/vi/frequent_words.txt \
profiles/vi/sentences.ini \
profiles/vi/stop_words.txt ${RHASSPY_APP}/profiles/vi/
COPY profiles/pt/profile.json \
profiles/pt/custom_words.txt \
profiles/pt/espeak_phonemes.txt \
profiles/pt/phoneme_examples.txt \
profiles/pt/frequent_words.txt \
profiles/pt/sentences.ini \
profiles/pt/stop_words.txt ${RHASSPY_APP}/profiles/pt/
COPY profiles/sv/profile.json \
profiles/sv/custom_words.txt \
profiles/sv/espeak_phonemes.txt \
profiles/sv/phoneme_examples.txt \
profiles/sv/frequent_words.txt \
profiles/sv/sentences.ini \
profiles/sv/stop_words.txt ${RHASSPY_APP}/profiles/sv/
COPY profiles/ca/profile.json \
profiles/ca/custom_words.txt \
profiles/ca/espeak_phonemes.txt \
profiles/ca/phoneme_examples.txt \
profiles/ca/frequent_words.txt \
profiles/ca/sentences.ini \
profiles/ca/stop_words.txt ${RHASSPY_APP}/profiles/ca/
COPY profiles/en/profile.json \
profiles/en/custom_words.txt \
profiles/en/espeak_phonemes.txt \
profiles/en/phoneme_examples.txt \
profiles/en/frequent_words.txt \
profiles/en/sentences.ini \
profiles/en/stop_words.txt ${RHASSPY_APP}/profiles/en/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1,96 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/openfst-1.6.2-1_${BUILD_ARCH}.deb /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then \
apt-get install --no-install-recommends --yes libfst-dev libfst-tools; \
else \
dpkg -i /openfst-1.6.2-1_${BUILD_ARCH}.deb; \
rm /openfst*.deb; \
fi
RHASSPY_TOOLS
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
ENV RHASSPY_APP /usr/share/rhasspy
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
COPY profiles/en/ ${RHASSPY_APP}/profiles/en/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1,113 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/openfst-1.6.2-1_${BUILD_ARCH}.deb /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then \
apt-get install --no-install-recommends --yes libfst-dev libfst-tools; \
else \
dpkg -i /openfst-1.6.2-1_${BUILD_ARCH}.deb; \
rm /openfst*.deb; \
fi
RHASSPY_TOOLS
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
RUN apt-get install -y pulseaudio
COPY etc/pulseaudio.client.conf /etc/pulse/client.conf
# Create new user
ENV UNAME=rhasspy
RUN export UNAME=$UNAME UID=1000 GID=1000 && \
mkdir -p "/home/${UNAME}" && \
echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \
echo "${UNAME}:x:${UID}:" >> /etc/group && \
mkdir -p /etc/sudoers.d && \
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
chmod 0440 /etc/sudoers.d/${UNAME} && \
chown ${UID}:${GID} -R /home/${UNAME} && \
gpasswd -a ${UNAME} audio
ENV RHASSPY_APP /home/${UNAME}
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
# Switch to new user
USER $UNAME
ENV HOME /home/${UNAME}
COPY profiles/en/ ${RHASSPY_APP}/profiles/en/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1,91 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/rhasspy-tools_${BUILD_ARCH}.tar.gz /
RUN tar -C /usr -xvf /rhasspy-tools_${BUILD_ARCH}.tar.gz && \
rm -f /rhasspy-tools_${BUILD_ARCH}.tar.gz
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils lame
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
ENV RHASSPY_APP /usr/share/rhasspy
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
COPY profiles/ ${RHASSPY_APP}/profiles/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
COPY VERSION ${RHASSPY_APP}/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1,91 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libfst-dev libfst-tools \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/rhasspy-tools_${BUILD_ARCH}.tar.gz /
RUN tar -C /usr -xvf /rhasspy-tools_${BUILD_ARCH}.tar.gz && \
rm -f /rhasspy-tools_${BUILD_ARCH}.tar.gz
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
ENV RHASSPY_APP /usr/share/rhasspy
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
COPY profiles/en/ ${RHASSPY_APP}/profiles/en/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
@@ -1,108 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL maintainer="Michael Hansen <hansen.mike@gmail.com>"
ARG BUILD_ARCH
ARG CPU_ARCH
ENV LANG C.UTF-8
ARG MAKE_THREADS=4
WORKDIR /
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libfst-dev libfst-tools \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/rhasspy-tools_${BUILD_ARCH}.tar.gz /
RUN tar -C /usr -xvf /rhasspy-tools_${BUILD_ARCH}.tar.gz && \
rm -f /rhasspy-tools_${BUILD_ARCH}.tar.gz
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
RUN apt-get install --no-install-recommends --yes flite libttspico-utils
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
RUN ldconfig
# Copy bw and mllr_solve to /usr/bin
RUN find / -name bw -exec cp '{}' /usr/bin/ \;
RUN find / -name mllr_solve -exec cp '{}' /usr/bin/ \;
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
RUN apt-get install -y pulseaudio
COPY etc/pulseaudio.client.conf /etc/pulse/client.conf
# Create new user
ENV UNAME=rhasspy
RUN export UNAME=$UNAME UID=1000 GID=1000 && \
mkdir -p "/home/${UNAME}" && \
echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \
echo "${UNAME}:x:${UID}:" >> /etc/group && \
mkdir -p /etc/sudoers.d && \
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
chmod 0440 /etc/sudoers.d/${UNAME} && \
chown ${UID}:${GID} -R /home/${UNAME} && \
gpasswd -a ${UNAME} audio
ENV RHASSPY_APP /home/${UNAME}
# Copy script to run
COPY docker/run.sh /run.sh
RUN chmod +x /run.sh
# Switch to new user
USER $UNAME
ENV HOME /home/${UNAME}
COPY profiles/en/ ${RHASSPY_APP}/profiles/en/
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
ENV CONFIG_PATH /data/options.json
ENV KALDI_PREFIX /opt
ENTRYPOINT ["/run.sh"]
-1
View File
@@ -1 +0,0 @@
COPY profiles/en/ ${RHASSPY_APP}/profiles/en/
@@ -1,7 +0,0 @@
COPY download/phonetisaurus-2019.tar.gz /phonetisaurus.tar.gz
RUN cd / && tar -xf phonetisaurus.tar.gz
RUN cd /phonetisaurus && \
./configure && \
make -j $MAKE_THREADS && \
make install && \
rm -rf /phonetisaurus*
@@ -1,18 +0,0 @@
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
COPY download/openfst-1.6.2-1_${BUILD_ARCH}.deb /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then \
apt-get install --no-install-recommends --yes libfst-dev libfst-tools; \
else \
dpkg -i /openfst-1.6.2-1_${BUILD_ARCH}.deb; \
rm /openfst*.deb; \
fi
-67
View File
@@ -1,67 +0,0 @@
#!/usr/bin/env bash
# Directory of *this* script
DIR="$( cd "$( dirname "$0" )" && pwd )"
template="$DIR/Dockerfile.template"
out="$DIR/dockerfiles"
mkdir -p "$out"
# -----------------------------------------------------------------------------
# Uppercases an input string
function upper {
tr '[[:lower:]]' '[[:upper:]]'
}
# Creates m4 "define" statements from text files in one or more directories.
# The contents of dir/file.txt will be the value of variable FILE.
function set_variables {
echo "divert(-1)"
while [[ ! -z "$1" ]]; do
if [[ -d "$1" ]]; then
for var_file in $(find "$1" -type f -name "*.txt"); do
var_name=$(basename "$var_file" .txt | upper)
echo "define(\`$var_name', \`$(cat $var_file)')"
done
elif [[ -f "$1" ]]; then
var_file="$1"
var_name=$(basename "$var_file" .txt | upper)
echo "define(\`$var_name', \`$(cat $var_file)')"
fi
shift
done
echo "divert(0)dnl"
}
# -----------------------------------------------------------------------------
#------------
# From source
#------------
# set_variables "$DIR/shared/" "$DIR/from-source/" \
# "$DIR/alsa/" "$DIR/en_profile/" \
# | cat - "$template" | m4 > "$out/Dockerfile.from-source.alsa.en"
# set_variables "$DIR/shared/" "$DIR/from-source/" \
# "$DIR/pulseaudio/" "$DIR/en_profile/" \
# | cat - "$template" | m4 > "$out/Dockerfile.from-source.pulseaudio.en"
# set_variables "$DIR/shared/" "$DIR/from-source/" \
# "$DIR/alsa/" "$DIR/all_profiles/" \
# | cat - "$template" | m4 > "$out/Dockerfile.from-source.alsa.all"
#-----------
# Pre-built
#-----------
# set_variables "$DIR/shared/" "$DIR/prebuilt/" \
# "$DIR/alsa/" "$DIR/en_profile/" \
# | cat - "$template" | m4 > "$out/Dockerfile.prebuilt.alsa.en"
# set_variables "$DIR/shared/" "$DIR/prebuilt/" \
# "$DIR/pulseaudio/" "$DIR/en_profile/" \
# | cat - "$template" | m4 > "$out/Dockerfile.prebuilt.pulseaudio.en"
set_variables "$DIR/shared/" "$DIR/prebuilt/" \
"$DIR/alsa/" "$DIR/all_profiles/" \
| cat - "$template" | m4 > "$out/Dockerfile.prebuilt.alsa.all"
@@ -1,3 +0,0 @@
COPY download/phonetisaurus-2019_${BUILD_ARCH}.deb /phonetisaurus.deb
RUN dpkg -i /phonetisaurus.deb && \
rm /phonetisaurus.deb
@@ -1,3 +0,0 @@
COPY download/rhasspy-tools_${BUILD_ARCH}.tar.gz /
RUN tar -C /usr -xvf /rhasspy-tools_${BUILD_ARCH}.tar.gz && \
rm -f /rhasspy-tools_${BUILD_ARCH}.tar.gz
@@ -1,10 +0,0 @@
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
bash jq unzip \
python3 python3-pip python3-dev \
build-essential portaudio19-dev swig \
libatlas-base-dev \
sox espeak flite alsa-utils \
git curl \
autoconf libtool automake bison \
sphinxbase-utils sphinxtrain
@@ -1,16 +0,0 @@
RUN apt-get install -y pulseaudio
COPY etc/pulseaudio.client.conf /etc/pulse/client.conf
# Create new user
ENV UNAME=rhasspy
RUN export UNAME=$UNAME UID=1000 GID=1000 && \
mkdir -p "/home/${UNAME}" && \
echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \
echo "${UNAME}:x:${UID}:" >> /etc/group && \
mkdir -p /etc/sudoers.d && \
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
chmod 0440 /etc/sudoers.d/${UNAME} && \
chown ${UID}:${GID} -R /home/${UNAME} && \
gpasswd -a ${UNAME} audio
ENV RHASSPY_APP /home/${UNAME}
@@ -1,3 +0,0 @@
# Switch to new user
USER $UNAME
ENV HOME /home/${UNAME}
-2
View File
@@ -1,2 +0,0 @@
# Install gstreamer and plugins
RUN apt-get install --no-install-recommends --yes gstreamer1.0-tools gstreamer1.0-plugins-good
-4
View File
@@ -1,4 +0,0 @@
COPY download/kaldi_${BUILD_ARCH}.tar.gz /kaldi.tar.gz
RUN mkdir -p /opt && \
tar -C /opt -xzf /kaldi.tar.gz && \
rm /kaldi.tar.gz
-9
View File
@@ -1,9 +0,0 @@
# Install mitlm
RUN apt-get install --no-install-recommends --yes gfortran
COPY download/mitlm-0.4.2.tar.xz /
RUN cd / && tar -xf mitlm-0.4.2.tar.xz && cd mitlm-0.4.2/ && \
./configure && \
make -j $MAKE_THREADS && \
make install && \
rm -rf /mitlm-0.4.2*
@@ -1,7 +0,0 @@
# Install Mycroft Precise
COPY download/precise-engine_0.3.0_${CPU_ARCH}.tar.gz /precise-engine.tar.gz
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then \
cd / && tar -xzf /precise-engine.tar.gz && \
ln -s /precise-engine/precise-engine /usr/bin/precise-engine && \
rm /precise-engine.tar.gz; \
fi
-9
View File
@@ -1,9 +0,0 @@
# Install Opengrm
COPY download/opengrm-ngram-1.3.3.tar.gz /
RUN cd / && tar -xf opengrm-ngram-1.3.3.tar.gz && \
cd opengrm-ngram-1.3.3 && \
./configure && \
make -j $MAKE_THREADS && \
make install && \
ldconfig && \
rm -rf /opengrm*
@@ -1,4 +0,0 @@
# Install Pocketsphinx Python module with no sound
COPY download/pocketsphinx-python.tar.gz /
RUN python3 -m pip install --no-cache-dir /pocketsphinx-python.tar.gz && \
rm -rf /pocketsphinx-python*
@@ -1,10 +0,0 @@
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN apt-get install -y libfreetype6-dev libpng-dev pkg-config libffi-dev libssl-dev
COPY requirements.txt /requirements.txt
RUN if [ "$BUILD_ARCH" != "amd64" ]; then \
grep -v flair /requirements.txt > /requirements-noflair.txt; \
mv /requirements-noflair.txt /requirements.txt; \
fi
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
-2
View File
@@ -1,2 +0,0 @@
COPY etc/qemu-arm-static /usr/bin/
COPY etc/qemu-aarch64-static /usr/bin/
-10
View File
@@ -1,10 +0,0 @@
COPY profiles/defaults.json ${RHASSPY_APP}/profiles/
COPY docker/rhasspy ${RHASSPY_APP}/bin/
COPY dist/ ${RHASSPY_APP}/dist/
COPY etc/wav/* ${RHASSPY_APP}/etc/wav/
COPY rhasspy/profile_schema.json ${RHASSPY_APP}/rhasspy/
COPY rhasspy/train/jsgf2fst/*.py ${RHASSPY_APP}/rhasspy/train/jsgf2fst/
COPY rhasspy/train/*.py ${RHASSPY_APP}/rhasspy/train/
COPY *.py ${RHASSPY_APP}/
COPY rhasspy/*.py ${RHASSPY_APP}/rhasspy/
COPY VERSION ${RHASSPY_APP}/
-3
View File
@@ -1,3 +0,0 @@
# Install snowboy
COPY download/snowboy-1.3.0.tar.gz /
RUN if [ "$BUILD_ARCH" != "aarch64" ]; then pip3 install --no-cache-dir /snowboy-1.3.0.tar.gz; fi
-1
View File
@@ -1 +0,0 @@
RUN apt-get install --no-install-recommends --yes flite libttspico-utils lame
-1
View File
@@ -1,4 +1,3 @@
attrs
adapt-parser==0.3.4
aiohttp==3.6.2
doit==0.31.1