FROM python:3.11-slim ARG TARGETPLATFORM RUN apt-get update && apt-get install --no-install-recommends -y curl ffmpeg RUN if [ "$TARGETPLATFORM" != "linux/amd64" ]; then apt-get install --no-install-recommends -y build-essential ; fi RUN if [ "$TARGETPLATFORM" != "linux/amd64" ]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ; fi ENV PATH="/root/.cargo/bin:${PATH}" RUN apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN mkdir -p voices config COPY requirements*.txt /app/ RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements-min.txt COPY *.py *.sh *.default.yaml README.md LICENSE /app/ # Ensure scripts are executable RUN chmod +x /app/*.sh # Add a non-root user and change ownership RUN useradd -ms /bin/bash appuser RUN chown -R appuser:appuser /app USER appuser WORKDIR /app ENV TTS_HOME=voices ENV HF_HOME=voices CMD bash startup.min.sh