-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (49 loc) · 2.03 KB
/
Dockerfile
File metadata and controls
65 lines (49 loc) · 2.03 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
# Stage 1: Build UI
FROM node:24-slim AS ui-build
WORKDIR /build
COPY ui/ ./ui/
RUN mkdir -p static
RUN cd ui && npm ci --ignore-scripts && npm run build
# Stage 2: Install Python dependencies
FROM python:3.11-slim AS py-deps
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libffi-dev curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install PDM (recommended method, pinned version)
RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 - --version 2.25.5
COPY pyproject.toml pdm.lock ./
RUN /root/.local/bin/pdm install --prod --no-editable --no-self --frozen-lockfile
# Stage 3: Runtime
FROM python:3.11-slim
ARG APP_VERSION=0.9.0
ENV APP_VERSION=${APP_VERSION}
LABEL maintainer="vladimir@jentic.com" \
org.opencontainers.image.authors="vladimir@jentic.com" \
org.opencontainers.image.url="https://github.com/jentic/jentic-mini" \
org.opencontainers.image.source="https://github.com/jentic/jentic-mini" \
org.opencontainers.image.description="Jentic Mini Docker image" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.version="${APP_VERSION}"
WORKDIR /app
COPY --from=py-deps /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
RUN mkdir -p /app/data /app/src
# Copy source into /app/src so that `from src.xxx` imports work from WORKDIR /app
COPY src/ /app/src/
# Copy Alembic migration config and scripts
COPY alembic.ini /app/alembic.ini
COPY alembic/ /app/alembic/
# Copy built UI assets from stage 1 — placed outside /app/src/ so the
# dev bind mount (./src:/app/src) doesn't hide them at runtime.
COPY --from=ui-build /build/static/ /app/static/
COPY --chmod=0644 LICENSE NOTICE llms.txt /app/
COPY --chmod=0755 docker-entrypoint.sh /app/docker-entrypoint.sh
# Run as non-root
RUN useradd -r -s /bin/false jentic \
&& chown -R jentic:jentic /app/data
USER jentic
EXPOSE 8900
# Entrypoint runs DB init + broker app seed before starting the server.
# Both steps are idempotent — safe on every container start.
CMD ["/app/docker-entrypoint.sh"]