-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.base
More file actions
62 lines (52 loc) · 2.99 KB
/
Copy pathDockerfile.base
File metadata and controls
62 lines (52 loc) · 2.99 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
56
57
58
59
60
61
62
FROM public.ecr.aws/lambda/python:3.12
# Add Lambda Web Adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
ENV START_COMMAND="jvagent ."
ENV JVAGENT_PORT=8080
ENV JVAGENT_HOST=0.0.0.0
# Add venv to PATH so CLI commands work
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /var/task
# Stage 1: OS packages and source (isolates dnf/git/clone failures)
RUN set -eux && \
dnf -y update && \
dnf install -y git file file-libs && \
git clone --depth 1 --single-branch --branch main https://github.com/TrueSelph/jvagent && \
git clone --depth 1 --single-branch --branch main https://github.com/TrueSelph/jvspatial
# Stage 2: venv and Python deps (Lambda image provides python3.12 under /var/lang/bin)
RUN set -eux && \
/var/lang/bin/python3.12 -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel && \
/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'numpy>=1.26.0,<2.0' && \
# litellm (pulled in by jvagent/pageindex) requires tiktoken>=0.8.0,<1.0, and
# pageindex itself declares >=0.11.0 — the old 'tiktoken<0.8.0' cap could not
# satisfy either. cp312 manylinux wheels exist across this range, so
# --only-binary still resolves.
/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'tiktoken>=0.11.0,<1.0' && \
/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'pydantic[email]' && \
# python-magic + file/file-libs so FileValidator sniffs Office MIME
# (docx/xlsx) instead of octet-stream on the sparse Lambda mime map.
(/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'python-magic' || \
/opt/venv/bin/pip install --no-cache-dir 'python-magic') && \
# /opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'docling>=2.0.0' && \
# /opt/venv/bin/pip install --no-cache-dir --only-binary=:all: 'tabulate>=0.9.0' && \
(/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: -e './jvspatial[lambda]' || \
/opt/venv/bin/pip install --no-cache-dir -e './jvspatial[lambda]') && \
(/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: -e ./jvagent || \
/opt/venv/bin/pip install --no-cache-dir -e ./jvagent) && \
(/opt/venv/bin/pip install --no-cache-dir --only-binary=:all: -r ./jvagent/requirements-all.txt || \
/opt/venv/bin/pip install --no-cache-dir -r ./jvagent/requirements-all.txt)
# Stage 3: verify CLI and drop build-only packages (keep file/file-libs for libmagic)
RUN set -eux && \
echo "Checking jvagent CLI availability..." && \
ls -l /opt/venv/bin/jvagent && \
/opt/venv/bin/jvagent --help && \
dnf -y remove git perl-Git && \
dnf clean all
# Verify venv persisted
RUN test -f /opt/venv/bin/python || (echo "ERROR: venv not found!" && exit 1)
# Create wrapper script that uses the CLI entry point directly
RUN printf '#!/bin/sh\nexec $START_COMMAND\n' > /var/task/run.sh && \
chmod +x /var/task/run.sh
ENTRYPOINT []
CMD ["/var/task/run.sh"]