Spaces:
Running
Running
File size: 1,260 Bytes
2a8b06e 40ce1fb 2a8b06e 40ce1fb 2a8b06e e0718c3 2a8b06e 40ce1fb 2a8b06e 40ce1fb ecff27e 2a8b06e ecff27e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
FROM python:3.11-slim
RUN --mount=type=cache,target=/root/.cache/pip pip install -U pip
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/*
# Add a non-root user and set permissions
RUN useradd -ms /bin/bash appuser
USER appuser
WORKDIR /home/appuser/app
RUN mkdir -p voices config
# Install piper
RUN --mount=type=cache,target=/home/appuser/.cache/pip pip install piper
ARG USE_ROCM
ENV USE_ROCM=${USE_ROCM}
COPY requirements*.txt /home/appuser/app/
RUN --mount=type=cache,target=/home/appuser/.cache/pip pip install -r requirements.txt
COPY *.py *.sh *.default.yaml README.md LICENSE /home/appuser/app/
# Switch to root to change script permissions
USER root
RUN chmod +x /home/appuser/app/*.sh
# Switch back to non-root user
USER appuser
ARG PRELOAD_MODEL
ENV PRELOAD_MODEL=${PRELOAD_MODEL}
ENV TTS_HOME=voices
ENV HF_HOME=voices
ENV COQUI_TOS_AGREED=1
CMD bash startup.sh |