-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile-dev
More file actions
55 lines (43 loc) · 1.89 KB
/
Copy pathDockerfile-dev
File metadata and controls
55 lines (43 loc) · 1.89 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.14-slim
WORKDIR /app
ARG DETECTMATELIBRARY_BRANCH=development
# Comma-separated detectmatelibrary extras to install, e.g. "llm,dataframes".
# Defaults to "full" (all optional components available). Pass an empty
# string to install only the base library.
ARG LIBRARY_EXTRAS=full
# Install straight into the system site-packages
# .venv, so `detectmate`/`python` work without activating anything.
ENV UV_PROJECT_ENVIRONMENT=/usr/local
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git && \
rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
COPY pyproject.toml uv.lock README.md ./
# --locked asserts uv.lock is up to date with pyproject.toml; the build
# fails instead of silently re-resolving if the lock is stale.
# --no-install-project installs only third-party dependencies,
# so this layer stays cached if the project code changes but dependencies don't..
RUN if [ -n "$LIBRARY_EXTRAS" ]; then \
uv sync --locked --no-dev --no-install-project --extra "$LIBRARY_EXTRAS" ; \
else \
uv sync --locked --no-dev --no-install-project ; \
fi
COPY ./src ./src
COPY ./tests ./tests
# dependencies are already installed above, so this is fast.
RUN if [ -n "$LIBRARY_EXTRAS" ]; then \
uv sync --locked --no-dev --extra "$LIBRARY_EXTRAS" ; \
else \
uv sync --locked --no-dev ; \
fi
RUN if [ "$DETECTMATELIBRARY_BRANCH" != "main" ]; then \
uv pip uninstall --system detectmatelibrary && \
if [ -n "$LIBRARY_EXTRAS" ]; then \
uv pip install --system "detectmatelibrary[$LIBRARY_EXTRAS] @ git+https://github.com/ait-detectmate/DetectMateLibrary.git@$DETECTMATELIBRARY_BRANCH" ; \
else \
uv pip install --system "detectmatelibrary @ git+https://github.com/ait-detectmate/DetectMateLibrary.git@$DETECTMATELIBRARY_BRANCH" ; \
fi ; \
fi
CMD ["detectmate", "--help"]