FROM golang:bullseye as mayhem-party-builder WORKDIR /mayhem-party.d RUN apt -y update && apt -y install libasound2-dev COPY git.d/mayhem-party.d/ ./ RUN go build -o /bin/mayhem-party FROM debian:stable-slim RUN apt -y update && apt -y upgrade && apt -y install wget # tts RUN \ wget https://github.com/rhasspy/larynx/releases/download/v1.1/larynx-tts_1.1.0_amd64.deb \ && apt -y install ./larynx-tts_1.1.0_amd64.deb \ && rm ./larynx-tts_1.1.0_amd64.deb # https://stackoverflow.com/questions/28985714/run-apps-using-audio-in-a-docker-container # stt #nogo since i need microphone #wait no i dont, i just need to set env or dont start RUN \ apt -y install portaudio19-dev python3-pyaudio python3-pip git pulseaudio \ && python3 -m pip install --no-cache-dir \ git+https://github.com/openai/whisper.git \ soundfile \ PyAudio \ SpeechRecognition \ PyYAML COPY ./git.d/stt.d/ /stt.d/ # sigusr1 # mayhem-party COPY --from=mayhem-party-builder /bin/mayhem-party /bin/mayhem-party # configs COPY ./config.d/ /config.d/ # entrypoint RUN echo 'date' > /entrypoint.sh \ && echo 'cleanup() { kill -9 $(jobs -p); wait; }; trap cleanup EXIT' >> /entrypoint.sh \ && echo '( export HOME=/mnt/tts.d; mkdir -p "$HOME"; cd "$HOME"; while true; do larynx-server --port 15002; sleep 5; done ) &' >> /entrypoint.sh \ && echo '( export HOME=/mnt/stt.d; mkdir -p "$HOME"; cd "$HOME"; device=$(pactl list | grep Monitor.Source | grep -v hdmi | awk "{print \$NF}" | head -n 1); (echo "pcm.pulse_monitor {"; echo "type pulse"; echo "device $device"; echo "}"; echo "ctl.pulse_monitor {"; echo "type pulse"; echo "device $device"; echo "}") > /etc/asound.conf; while true; do cd /stt.d/whisper-2023; HOTWORDS=/config.d/mayhem-party.d/v01.yaml@.users[].state.gm.alias MIC_TIMEOUT=2 URL=http://localhost:17071/gm/rpc/broadcastSomeoneSaidAlias?message={{hotword}} HEADERS=say="Eye herd {{hotword}}" MIC_NAME=pulse_monitor python3 ./hotwords.py; sleep 5; done ) &' >> /entrypoint.sh \ && echo 'echo running mayhem party; source /config.d/mayhem-party.d/env.env; if ! /bin/mayhem-party; then echo mayhem-party failure; exit 1; fi' >> /entrypoint.sh ENTRYPOINT [] CMD ["bash", "/entrypoint.sh"]