Skip to content

Instantly share code, notes, and snippets.

@YoSarin
Last active January 19, 2024 19:12
Show Gist options
  • Select an option

  • Save YoSarin/d760699f24e236a9af611df42f289f67 to your computer and use it in GitHub Desktop.

Select an option

Save YoSarin/d760699f24e236a9af611df42f289f67 to your computer and use it in GitHub Desktop.
version: '3'
services:
# homeassistant service somewhere here
# stt from MS here
azurestt:
container_name: azure-stt
build:
context: .
dockerfile: Dockerfile # whatever name you saved the other file as
restart: unless-stopped
ports:
- 10300:10300
working_dir: /azure-stt
command: python3 -m wyoming-microsoft-stt --service-region northeurope --uri tcp://0.0.0.0:10300 --subscription-key <your subscription key>
FROM amd64/python:3
WORKDIR /
RUN mkdir /install
RUN mkdir /install/openssl
RUN mkdir /azure-stt
# updating sources
RUN apt-get update
# dependencies for linux
# based on https://learn.microsoft.com/en-us/azure/ai-services/speech-service/quickstarts/setup-platform?pivots=programming-language-python&tabs=linux%2Cdebian%2Cdotnetcli%2Cdotnet%2Cjre%2Cmaven%2Cnodejs%2Cmac%2Cpypi#platform-requirements
RUN apt-get -y install build-essential libssl-dev ca-certificates libasound2 wget
# installing openssl 1.1.1
RUN wget -O /install/openssl.tar.gz https://www.openssl.org/source/openssl-1.1.1u.tar.gz
RUN tar -xzf /install/openssl.tar.gz -C /install/openssl --strip-components 1
WORKDIR /install/openssl
RUN ./config --prefix=/usr/local
RUN make -j $(nproc)
RUN make install_sw install_ssldirs
RUN ldconfig -v
RUN export SSL_CERT_DIR=/etc/ssl/certs
WORKDIR /
# download and unpack microsoft-stt
ADD https://github.com/hugobloem/wyoming-microsoft-stt/archive/refs/tags/1.0.0.tar.gz /install
RUN tar -xzf /install/1.0.0.tar.gz --strip-components 1 -C /azure-stt
# pip install
RUN pip3 install /azure-stt/
# this is weird (check RUN export SSL_CERT_DIR line)
# but for some reason it does not work without it
# see https://stackoverflow.com/a/76735248 - I was not alone
ENV SSL_CERT_DIR=/usr/lib/ssl/certs
# cleanup
RUN rm /install -rf
RUN apt-get clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment