MH0386 commited on
Commit
b772843
·
verified ·
1 Parent(s): 156adb3

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +30 -22
  2. pylock.toml +0 -0
Dockerfile CHANGED
@@ -1,40 +1,48 @@
1
- FROM python:3.12-slim-bookworm
2
 
3
  ENV UV_COMPILE_BYTECODE=1 \
4
- UV_NO_CACHE=1 \
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
- # skipcq: DOK-DL3008
12
- RUN groupadd vocalizr && \
13
- useradd -g vocalizr -s /bin/bash -d /app vocalizr && \
14
- apt-get update -qq && \
15
- apt-get install -qq -y --no-install-recommends espeak-ng ffmpeg && \
16
- apt-get clean -qq && \
17
- rm -rf /var/lib/apt/lists/*
 
18
 
19
- COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 
20
 
21
- RUN uv tool install --quiet huggingface-hub[cli] && \
22
  huggingface-cli download --quiet hexgrad/Kokoro-82M && \
23
  uv tool uninstall --quiet huggingface-hub
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  WORKDIR /app
26
 
27
- RUN --mount=type=bind,source=uv.lock,target=uv.lock \
28
- --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
29
- --mount=type=bind,source=.python-version,target=.python-version \
30
- --mount=type=bind,source=README.md,target=README.md \
31
- --mount=type=bind,source=src,target=/app/src \
32
- uv pip install --system -r pyproject.toml
33
 
34
  RUN chown -R vocalizr:vocalizr /app
35
 
36
- COPY --chown=vocalizr:vocalizr . /app
37
-
38
  USER vocalizr
39
 
40
  EXPOSE ${GRADIO_SERVER_PORT}
 
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 --no-install-project --no-dev
16
+
17
+ COPY . /app
18
 
19
+ RUN --mount=type=cache,target=/root/.cache/uv \
20
+ uv sync --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
+ PATH="/app/.venv/bin:$PATH"
31
+
32
+ # skipcq: DOK-DL3008
33
+ RUN addgroup vocalizr && \
34
+ adduser -D -h /app -G vocalizr vocalizr && \
35
+ apk update && \
36
+ apk add --no-cache espeak-ng ffmpeg && \
37
+ rm -rf /var/cache/apk/*
38
+
39
  WORKDIR /app
40
 
41
+ COPY --from=builder --chown=vocalizr:vocalizr /app /app
42
+ COPY --from=builder /root/.cache/huggingface/hub/ /root/.cache/huggingface/hub/
 
 
 
 
43
 
44
  RUN chown -R vocalizr:vocalizr /app
45
 
 
 
46
  USER vocalizr
47
 
48
  EXPOSE ${GRADIO_SERVER_PORT}
pylock.toml ADDED
The diff for this file is too large to render. See raw diff