mayhem-party-venue/Dockerfile

48 lines
1.9 KiB
Docker

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 \
&& python3 -m pip install \
git+https://github.com/openai/whisper.git \
soundfile \
PyAudio \
SpeechRecognition
RUN python3 -m pip install PyYAML
RUN apt install -y pulseaudio
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 '( 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 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"]