Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (59 loc) · 2 KB
/
Copy pathDockerfile
File metadata and controls
77 lines (59 loc) · 2 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM python:3.15.2-alpine AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apk add --no-cache \
build-base \
cargo \
openssl-dev \
nodejs \
npm \
pkgconf
RUN python -m pip install --no-cache-dir --upgrade pip setuptools \
&& pip install --no-cache-dir uv
COPY pyproject.toml uv.lock README.md /app/
COPY i3x_server /app/i3x_server
COPY frontend /app/frontend
ARG INSTALL_OTEL=false
RUN if [ "$INSTALL_OTEL" = "true" ]; then \
uv sync --no-dev --frozen --extra otel; \
else \
uv sync --no-dev --frozen; \
fi
RUN cd /app/frontend \
&& npm ci \
&& npm run build
FROM python:3.15.2-alpine AS runtime
ARG BUILD_VERSION=master
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/app/.venv/bin:${PATH}"
WORKDIR /app
RUN apk add --no-cache \
ca-certificates \
tini \
&& rm -rf \
/usr/local/lib/python3.15/site-packages/pip \
/usr/local/lib/python3.15/site-packages/pip-*.dist-info \
/usr/local/lib/python3.15/ensurepip \
&& rm -f \
/usr/local/bin/pip \
/usr/local/bin/pip3 \
/usr/local/bin/pip3.15 \
&& addgroup -g 10001 -S app \
&& adduser -u 10001 -S -D -H -G app app
COPY --from=builder /app/.venv /app/.venv
COPY i3x_server /app/i3x_server
COPY --from=builder /app/dist /app/dist
COPY static /app/static
# MCP tool/prompt overrides are resolved relative to /app/overrides; without this the
# shipped image silently runs with the built-in definitions.
COPY overrides /app/overrides
RUN printf "%s\n" "${BUILD_VERSION}" > /app/server-version.txt \
&& chown app:app /app/server-version.txt
USER app
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/v1/info', timeout=3)"
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["python", "-m", "uvicorn", "i3x_server.main:app", "--host", "0.0.0.0", "--port", "8000"]