File size: 1,312 Bytes
d7b8eec
b9a47ba
 
264f729
d7b8eec
face19a
612cc5c
3a7d13f
 
264f729
 
 
b9a47ba
56c627f
0d6f8c1
4058306
 
56c627f
8739095
d7b8eec
b9a47ba
4058306
 
 
26a56bb
264f729
c67d34c
264f729
5ec2f03
 
782796f
5297e98
6ce7bef
6a568f2
3e60f77
5297e98
 
5ab5ef6
fb29175
7c67037
 
8739095
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
FROM python:3.12-slim-bookworm

ENV UV_COMPILE_BYTECODE=1 \
    UV_NO_CACHE=1 \
    UV_SYSTEM_PYTHON=1 \
    UV_FROZEN=1 \
    PATH="/root/.local/bin:$PATH" \
    GRADIO_SERVER_PORT=8080 \
    GRADIO_SERVER_NAME=0.0.0.0

RUN groupadd vocalizr && \
    useradd --gid vocalizr --shell /bin/bash --create-home vocalizr

# skipcq: DOK-DL3008
RUN apt-get update -qq && \
    apt-get install -qq -y --no-install-recommends espeak-ng && \
    apt-get clean -qq && \
    rm -rf /var/lib/apt/lists/*

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN uv tool install --quiet huggingface-hub[cli] && \
    huggingface-cli download --quiet hexgrad/Kokoro-82M && \
    uv tool uninstall --quiet huggingface-hub

WORKDIR /home/vocalizr/app

RUN --mount=type=bind,source=uv.lock,target=uv.lock \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    --mount=type=bind,source=.python-version,target=.python-version \
    --mount=type=bind,source=README.md,target=README.md \
    --mount=type=bind,source=src,target=/home/vocalizr/app/src \
    uv export --no-hashes --no-editable --no-dev --quiet -o requirements.txt && \
    uv pip install --system -r requirements.txt

COPY --chown=vocalizr:vocalizr /src /home/vocalizr/app

USER vocalizr

EXPOSE ${GRADIO_SERVER_PORT}

CMD ["python", "vocalizr"]