-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgpu-tensorrt.Dockerfile
More file actions
55 lines (43 loc) · 2.15 KB
/
Copy pathgpu-tensorrt.Dockerfile
File metadata and controls
55 lines (43 loc) · 2.15 KB
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
# An example using multi-stage image builds to create a final image without uv.
# First, build the application in the `/app` directory.
# See `Dockerfile` for details.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder-base
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
# Disable Python downloads, because we want to use the system interpreter
# across both images. If using a managed Python version, it needs to be
# copied from the build image into the final image; see `standalone.Dockerfile`
# for an example.
ENV UV_PYTHON_DOWNLOADS=0
WORKDIR /app
FROM builder-base AS packages-builder
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project --no-dev --extra gpu-trt -v
FROM builder-base AS app-builder
COPY wyoming_onnx_asr/ ./wyoming_onnx_asr/
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv venv && \
uv pip install --no-deps .
FROM python:3.12-slim-bookworm
# It is important to use the image that matches the builder, as the path to the
# Python executable must be the same, e.g., using `python:3.11-slim-bookworm`
# will fail.
WORKDIR /app
COPY --from=packages-builder --chown=app:app /app/.venv /app/.venv
# Copy just the site-packages from our app installation (tiny layer)
COPY --from=app-builder --chown=app:app /app/.venv/lib/python3.12/site-packages /app/.venv/lib/python3.12/site-packages/
# Copy the application from the builder
#COPY --from=builderproject --chown=app:app /app/wyoming* /app/wyoming*
COPY wyoming_onnx_asr/ /app/wyoming_onnx_asr/
# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
VOLUME /data
VOLUME /cache
ENV ONNX_ASR_MODEL_DIR="/data"
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.venv/lib/python3.12/site-packages/tensorrt_libs/
ENV ORT_TENSORRT_ENGINE_CACHE_ENABLE=1
ENV ORT_TENSORRT_CACHE_PATH=/cache/tensorrt
ENTRYPOINT ["python", "-m", "wyoming_onnx_asr", "--device", "gpu-trt"]
CMD [ "--uri", "tcp://*:10300", "--model-en", "nemo-parakeet-tdt-0.6b-v2" ]