File size: 3,140 Bytes
0bf1cff 63e8252 0bf1cff 63e8252 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff f0ce1ab 1b2c594 83aa2cd 6b5db35 18dd075 0bf1cff 3b66c0f 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff fd41b38 0bf1cff fd41b38 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff abdd5d9 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff 18dd075 0bf1cff abdd5d9 8e28001 88cbd82 0bf1cff 80b59ce 1ca3621 d48498a ddd7cf9 0bf1cff | 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | # syntax=docker/dockerfile:1
# TODO: build-arg と target のドキュメントをこのファイルに書く
ARG BASE_IMAGE=mirror.gcr.io/ubuntu:22.04
FROM ${BASE_IMAGE} AS download-env
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /work
RUN <<EOF
set -eux
apt-get update
apt-get install -y \
curl \
p7zip
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF
# Download VOICEVOX ENGINE
ENV VOICEVOX_ENGINE_TARGET=linux-cpu-x64
ENV VOICEVOX_ENGINE_VERSION=0.25.1
ENV VOICEVOX_ENGINE_REPOSITORY=VOICEVOX/voicevox_engine
ENV VV_HOST=0.0.0.0
RUN <<EOF
set -eux
LIST_NAME=voicevox_engine-$VOICEVOX_ENGINE_TARGET-$VOICEVOX_ENGINE_VERSION.7z.txt
curl -fLO --retry 3 --retry-delay 5 "https://github.com/$VOICEVOX_ENGINE_REPOSITORY/releases/download/$VOICEVOX_ENGINE_VERSION/$LIST_NAME"
awk \
-v "repo=$VOICEVOX_ENGINE_REPOSITORY" \
-v "tag=$VOICEVOX_ENGINE_VERSION" \
'{
print \
"url = \"https://github.com/" repo "/releases/download/" tag "/" $0 "\"\n" \
"output = \"" $0 "\""
}' \
"$LIST_NAME" \
> ./curl.txt
curl -fL --retry 3 --retry-delay 5 --parallel --config ./curl.txt
7zr x "$(head -1 "./$LIST_NAME")"
mv ./$VOICEVOX_ENGINE_TARGET /opt/voicevox_engine
rm ./*
EOF
# Download Resource
ARG VOICEVOX_RESOURCE_VERSION=0.25.1
RUN <<EOF
set -eux
# README
curl -fLo "/work/README.md" --retry 3 --retry-delay 5 "https://raw.githubusercontent.com/VOICEVOX/voicevox_resource/${VOICEVOX_RESOURCE_VERSION}/engine/README.md"
EOF
# Download COEIROINK v2 bridge
ARG COEIROINK_BRIDGE_VERSION=0.1.0
RUN <<EOF
set -eux
mkdir -p /work/vvpp
curl -fLo "/work/vvpp/coeiroink-bridge-v${COEIROINK_BRIDGE_VERSION}.vvpp" \
--retry 3 \
--retry-delay 5 \
"https://github.com/sevenc-nanashi/coeiroink-v2-bridge/releases/download/v${COEIROINK_BRIDGE_VERSION}/coeiroink-bridge-v${COEIROINK_BRIDGE_VERSION}.vvpp"
EOF
# Runtime
FROM ${BASE_IMAGE} AS runtime-env
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /opt/voicevox_engine
RUN <<EOF
set -eux
apt-get update
apt-get install -y \
gosu
apt-get clean
rm -rf /var/lib/apt/lists/*
# Create a general user
useradd --create-home user
EOF
# Copy VOICEVOX ENGINE
COPY --from=download-env /opt/voicevox_engine /opt/voicevox_engine
# Copy Resource
COPY --from=download-env /work/README.md /opt/voicevox_engine/README.md
# Copy COEIROINK v2 bridge
COPY --from=download-env /work/vvpp /opt/voicevox_engine/vvpp
RUN export VV_HOST=0.0.0.0
ENV VV_HOST=0.0.0.0
RUN apt-get update && apt-get install -y python3 && rm -rf /var/lib/apt/lists/*
# Copy COEIROINK v2 bridge
COPY --from=download-env /work/vvpp /opt/voicevox_engine/vvpp
RUN <<EOF
set -eux
apt-get update
apt-get install -y \
gosu \
p7zip
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF
CMD ["gosu","user","/opt/voicevox_engine/run","--host", "0.0.0.0","--port","7860","--cors_policy_mode","all"]
# Enable use_gpu
FROM runtime-env AS runtime-nvidia-env
ENV VV_USE_GPU=1 |