Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +28 -22
Dockerfile
CHANGED
@@ -1,43 +1,49 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
ENV UV_COMPILE_BYTECODE=1 \
|
4 |
-
|
5 |
UV_SYSTEM_PYTHON=1 \
|
|
|
6 |
UV_FROZEN=1 \
|
7 |
-
PATH="/root/.local/bin:$PATH"
|
8 |
-
GRADIO_SERVER_PORT=8080 \
|
9 |
-
GRADIO_SERVER_NAME=0.0.0.0
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
-
RUN uv tool install --quiet
|
18 |
huggingface-cli download --quiet hexgrad/Kokoro-82M && \
|
19 |
uv tool uninstall --quiet huggingface-hub
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
28 |
apk update && \
|
29 |
-
apk add --no-cache build-base python3-dev linux-headers espeak-ng-dev && \
|
30 |
apk add --no-cache espeak-ng ffmpeg && \
|
31 |
-
uv export --no-hashes --no-editable --no-dev --quiet -o requirements.txt && \
|
32 |
-
uv pip install --system -r requirements.txt && \
|
33 |
rm -rf /var/cache/apk/*
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
|
39 |
USER vocalizr
|
40 |
|
41 |
EXPOSE ${GRADIO_SERVER_PORT}
|
42 |
|
43 |
-
CMD ["python", "src/vocalizr"]
|
|
|
1 |
+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
|
2 |
|
3 |
ENV UV_COMPILE_BYTECODE=1 \
|
4 |
+
UV_LINK_MODE=copy \
|
5 |
UV_SYSTEM_PYTHON=1 \
|
6 |
+
UV_PYTHON_DOWNLOADS=0 \
|
7 |
UV_FROZEN=1 \
|
8 |
+
PATH="/root/.local/bin:$PATH"
|
|
|
|
|
9 |
|
10 |
+
WORKDIR /app
|
11 |
+
|
12 |
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
13 |
+
--mount=type=bind,source=uv.lock,target=uv.lock \
|
14 |
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
15 |
+
uv sync --locked --no-install-project --no-dev
|
16 |
+
|
17 |
+
COPY . /app
|
18 |
|
19 |
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
20 |
+
uv sync --locked --no-dev
|
21 |
|
22 |
+
RUN uv tool install --quiet huggingface_hub[cli] && \
|
23 |
huggingface-cli download --quiet hexgrad/Kokoro-82M && \
|
24 |
uv tool uninstall --quiet huggingface-hub
|
25 |
|
26 |
+
FROM python:3.12-alpine AS production
|
27 |
|
28 |
+
ENV GRADIO_SERVER_PORT=7860 \
|
29 |
+
GRADIO_SERVER_NAME=0.0.0.0
|
30 |
+
|
31 |
+
# skipcq: DOK-DL3008
|
32 |
+
RUN addgroup vocalizr && \
|
33 |
+
adduser -D -h /app -G vocalizr vocalizr && \
|
34 |
apk update && \
|
|
|
35 |
apk add --no-cache espeak-ng ffmpeg && \
|
|
|
|
|
36 |
rm -rf /var/cache/apk/*
|
37 |
|
38 |
+
WORKDIR /app
|
39 |
+
|
40 |
+
COPY --from=builder --chown=vocalizr:vocalizr /app /app
|
41 |
+
COPY --from=builder /root/.cache/huggingface/hub/ /root/.cache/huggingface/hub/
|
42 |
|
43 |
+
RUN chown -R vocalizr:vocalizr /app
|
44 |
|
45 |
USER vocalizr
|
46 |
|
47 |
EXPOSE ${GRADIO_SERVER_PORT}
|
48 |
|
49 |
+
CMD ["python", "src/vocalizr"]
|