You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.2 KiB

FROM nvidia/cuda:12.6.1-cudnn-runtime-ubuntu24.04
ENV DEBIAN_FRONTEND=noninteractive
##
## User.
##
RUN apt update && apt install -y sudo
RUN groupadd -r user
RUN useradd -r -g user -m -s /bin/bash user
RUN usermod -aG sudo user
RUN echo "user ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
USER user
WORKDIR /home/user
ENV USER=user
##
## Time zone.
##
ENV TZ=Europe/Moscow
RUN sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
RUN echo $TZ | sudo tee /etc/timezone
##
## RealTimeSTT.
##
RUN sudo apt update && sudo apt install -y python3
RUN sudo apt update && sudo apt install -y python3-pip
RUN sudo apt update && sudo apt install -y python3-venv
RUN sudo apt update && sudo apt install -y portaudio19-dev
RUN sudo apt update && sudo apt install -y ffmpeg
RUN python3 -m venv venv
RUN bash -c "source venv/bin/activate && pip install RealtimeSTT==0.3.7"
RUN bash -c "source venv/bin/activate && pip install torch==2.3.1+cu121 --index-url https://download.pytorch.org/whl/cu121"
RUN bash -c "source venv/bin/activate && pip install torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121"
# Replace `localhost` with `0.0.0.0` in STT server.
RUN bash -c "source venv/bin/activate && \
cd ~/venv/lib/python3.12/site-packages/RealtimeSTT_server && \
find . -type f -exec sed -i.backup "s/localhost/0\.0\.0\.0/g" {} \;"
##
## LLM.
##
RUN bash -c "source venv/bin/activate && pip install llama-index==0.11.23"
RUN bash -c "source venv/bin/activate && pip install llama-index-llms-ollama==0.3.6"
##
## RealTimeTTS.
##
RUN sudo apt update && sudo apt install -y espeak # System TTS for TTS server.
RUN sudo apt update && sudo apt install -y git
RUN bash -c "source venv/bin/activate && pip install 'RealTimeTTS[all]==0.4.10'"
RUN bash -c "source venv/bin/activate && pip install fastapi==0.115.5" # For TTS server.
RUN bash -c "source venv/bin/activate && pip install uvicorn==0.32.0" # For TTS server.
RUN git clone https://github.com/KoljaB/RealtimeTTS && \
cd RealtimeTTS && \
git reset --hard b2fab8b57717d2a14501923e9cf2b5589944b9ca
# Replace.
RUN bash -c "source venv/bin/activate && \
cd RealtimeTTS/example_fast_api && \
sed -i.backup \"s/START_ENGINE = SUPPORTED_ENGINES\[0\]/START_ENGINE = 'coqui'/g\" server.py"