-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (38 loc) · 1.95 KB
/
Dockerfile
File metadata and controls
55 lines (38 loc) · 1.95 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
FROM python:3.10-slim-bookworm@sha256:a02d127ac3e004d100268fcf394e8d673e1f43f2ac84d2f38f7d8345f18890b3 AS base
FROM base AS build
# Install Git and clone the OTX at the specified tag
ARG OTX_RELEASE_TAG=2.6.0
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git
RUN git clone --branch $OTX_RELEASE_TAG --single-branch https://github.com/open-edge-platform/training_extensions.git
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
# Disable Python downloads, because we want to use the system interpreter across both images.
ENV UV_PYTHON_DOWNLOADS=0
# Copy the service dependencies
COPY --link --from=libs . libs
COPY --link --from=iai_core . interactive_ai/libs/iai_core_py
COPY --link --from=supported_models . interactive_ai/supported_models
WORKDIR /interactive_ai/services/director
COPY --link --from=ghcr.io/astral-sh/uv:0.6.12@sha256:515b886e8eb99bcf9278776d8ea41eb4553a794195ef5803aa7ca6258653100d /uv /bin/uv
COPY --link app/ app
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 --frozen --no-dev --no-editable
FROM base AS runtime
RUN useradd -l -u 10001 non-root && \
pip3 uninstall -y setuptools pip wheel && \
rm -rf /root/.cache/pip
# Copy the application from the builder
COPY --link --from=build --chown=10001 /interactive_ai/services/director /interactive_ai/services/director
COPY --link --from=build --chown=10001 /training_extensions/lib/src/otx/tools/templates /model_templates
COPY --link --from=schemas . /interactive_ai/services/api
ENV MODEL_TEMPLATES_DIR=/model_templates
# Place executables in the environment at the front of the path
ENV PATH="/interactive_ai/services/director/.venv/bin:$PATH"
ENV PYTHONPATH="/interactive_ai/services/director:/interactive_ai/services/director/app"
USER non-root
WORKDIR /interactive_ai/services/director/app/communication
CMD ["python", "main.py"]