FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 # Model choices ARG TEXT_MODEL=llama-v3-2-3b-instruct-q6-k ARG TRANSCRIBE_MODEL=distilled-whisper-large-v3 ARG SPEECH_MODEL=kokoro # Create user RUN useradd -m -u 1000 anachrovox # Set home and work directory ENV HOME=/app \ PATH=/app/.local/bin:$PATH WORKDIR /app # Copy configuration COPY config/nginx.conf /app/nginx.conf COPY config/dispatcher.yaml /app/dispatcher.yaml COPY config/overseer.yaml /app/overseer.yaml # Copy WWW contents ADD www /app/www # Copy Anachrovox application code ADD src/anachrovox /app/anachrovox # Create log directory RUN mkdir -p /app/logs # Expose port EXPOSE 7860 # Install packages including spaces dev mode requirements RUN apt-get update && \ apt-get install -y \ bash \ git git-lfs \ curl wget procps \ htop vim \ python3-pip python3-dev \ espeak-ng \ nginx && \ rm -rf /var/lib/apt/lists/* # Adjust permissions RUN chown -R 1000 /var/log/nginx /var/lib/nginx /app # Drop privileges USER 1000 # Install taproot RUN pip3 install --no-cache-dir taproot[tools,console,av] # Install models - spaces doesn't seem to care about layer size, so we minimize overall size instead RUN taproot install \ audio-transcription:${TRANSCRIBE_MODEL} \ text-generation:${TEXT_MODEL} \ speech-synthesis:${SPEECH_MODEL} \ --optional \ --debug # Copy run script COPY --chown=anachrovox --chmod=755 run.sh /app/run.sh # Run the application CMD ["/app/run.sh"]