Refactor dockerfile and entrypoint script

This commit is contained in:
2026-02-18 22:55:13 -03:00
parent 5366d4045e
commit 7018ff9d07
5 changed files with 57 additions and 134 deletions
+30 -25
View File
@@ -1,34 +1,39 @@
FROM nvidia/cuda:12.9.1-cudnn-devel-ubuntu24.04
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PATH="/usr/local/bin:/root/.local/bin:/root/bin:/piper/.venv/bin:${PATH}"
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1 \
VENV_PATH=/opt/venv
RUN apt-get update && apt upgrade -y && apt-get install -y --no-install-recommends \
bash coreutils vim nano \
git curl wget ca-certificates gnupg \
build-essential pkg-config ninja-build cmake \
python3 python3-pip python3-venv python3-dev \
ffmpeg espeak-ng \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
RUN chmod +x /usr/local/bin/uv
ENV PATH="${VENV_PATH}/bin:${PATH}"
WORKDIR /piper
RUN git clone --depth 1 --branch v1.3.0 https://github.com/OHF-voice/piper1-gpl.git .
# RUN if ! [ -d wavs ]; then mkdir wavs; fi && if ! [ -d metadata ]; then mkdir metadata; fi && if ! [ -d checkpoints ]; then mkdir checkpoints; fi && if ! [ -d lightning_logs ]; then mkdir lightning_logs; fi && if ! [ -d cache ]; then mkdir cache; fi
RUN uv python install 3.13 && uv python pin 3.13 && uv venv .venv --python 3.13
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
espeak-ng \
git \
ninja-build \
pkg-config \
python3 \
python3-dev \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN uv pip install -e .[train] torch==2.5.1 lightning==2.1.0 numpy "ml_dtypes>=0.5.0" scikit-build \
--index https://download.pytorch.org/whl/cu124 \
--index https://pypi.org/simple \
--index-strategy=unsafe-best-match \
--compile-bytecode
RUN git clone --depth 1 https://github.com/OHF-voice/piper1-gpl.git .
RUN uv run python3 setup.py build_ext --inplace
RUN . .venv/bin/activate && ./build_monotonic_align.sh
RUN python3 -m venv ${VENV_PATH}
ENV UV_OFFLINE=1
RUN pip install --upgrade pip wheel setuptools \
&& pip install --no-cache-dir cmake scikit-build \
&& pip install --no-cache-dir -e '.[train]'
RUN ./build_monotonic_align.sh \
&& python3 setup.py build_ext --inplace
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]