mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-25 16:42:16 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
147 lines
3.9 KiB
Docker
147 lines
3.9 KiB
Docker
# ── Multi-stage Dockerfile for Native Bun Runtime (web-latest-bun) ───────────
|
|
FROM oven/bun:1.3.14-slim AS base
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
python3 \
|
|
python-is-python3 \
|
|
make \
|
|
g++ \
|
|
libsecret-1-0 \
|
|
ca-certificates \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Builder stage (100% Bun Native Install & Build) ─────────────────────────
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
# Fast Bun native package install
|
|
RUN bun install --include=optional --quiet
|
|
|
|
# Compile native better-sqlite3 Node-API addon under Bun
|
|
RUN if [ -d "node_modules/better-sqlite3" ]; then \
|
|
(cd node_modules/better-sqlite3 && bunx node-gyp rebuild); \
|
|
fi
|
|
|
|
# Fetch tls-client-node native binary if script exists
|
|
RUN if [ -f "node_modules/tls-client-node/scripts/postinstall.js" ]; then \
|
|
bun node_modules/tls-client-node/scripts/postinstall.js || true; \
|
|
fi
|
|
|
|
# Disable Turbopack for Bun builder stage (Turbopack V8 internal worker bindings require Node)
|
|
ENV OMNIROUTE_USE_TURBOPACK=0
|
|
|
|
ARG OMNIROUTE_BASE_PATH=""
|
|
ENV OMNIROUTE_BASE_PATH=$OMNIROUTE_BASE_PATH
|
|
|
|
ARG DASHBOARD_ALLOW_EMBED=""
|
|
ENV DASHBOARD_ALLOW_EMBED=$DASHBOARD_ALLOW_EMBED
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV NODE_ENV=production
|
|
|
|
# Bun native Next.js build execution
|
|
RUN bun run --quiet build
|
|
|
|
# ── Runner Base stage (100% Bun Native Production Runtime) ──────────────────
|
|
FROM oven/bun:1.3.14-slim AS runner-base
|
|
|
|
LABEL org.opencontainers.image.title="omniroute" \
|
|
org.opencontainers.image.description="Unified AI proxy — route any LLM through one endpoint (Bun Native)" \
|
|
org.opencontainers.image.url="https://omniroute.online" \
|
|
org.opencontainers.image.source="https://github.com/diegosouzapw/OmniRoute" \
|
|
org.opencontainers.image.licenses="MIT"
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
libsecret-1-0 \
|
|
ca-certificates \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=20128
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV OMNIROUTE_MEMORY_MB=1024
|
|
|
|
ENV DATA_DIR=/app/data
|
|
RUN mkdir -p /app/data
|
|
|
|
COPY --from=builder /app/.build/next/standalone ./
|
|
COPY --from=builder /app/node_modules/better-sqlite3 ./node_modules/better-sqlite3
|
|
ENV OMNIROUTE_MIGRATIONS_DIR=/app/migrations
|
|
|
|
COPY --from=builder /app/scripts/dev/healthcheck.mjs ./healthcheck.mjs
|
|
|
|
EXPOSE 20128
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD bun healthcheck.mjs || exit 1
|
|
|
|
ENTRYPOINT ["bun", "dev/run-standalone.mjs"]
|
|
|
|
# ── Runner Web stage (Bun Native + Chromium/Playwright for Web providers) ───
|
|
FROM runner-base AS runner-web
|
|
|
|
USER root
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
chromium \
|
|
chromium-driver \
|
|
fonts-liberation \
|
|
libasound2t64 \
|
|
gconf-service \
|
|
libatk-bridge2.0-0 \
|
|
libatk1.0-0 \
|
|
libc6 \
|
|
libcairo2 \
|
|
libcups2 \
|
|
libdbus-1-3 \
|
|
libexpat1 \
|
|
libfontconfig1 \
|
|
libgbm1 \
|
|
libgcc-s1 \
|
|
libglib2.0-0 \
|
|
libgtk-3-0 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libpango-1.0-0 \
|
|
pangocairo-1.0-0 \
|
|
stdc++6 \
|
|
libx11-6 \
|
|
libx11-xcb1 \
|
|
libxcb1 \
|
|
libxcomposite1 \
|
|
libxcursor1 \
|
|
libxdamage1 \
|
|
libxext6 \
|
|
libxfixes3 \
|
|
libxi6 \
|
|
libxrandr2 \
|
|
libxrender1 \
|
|
libxss1 \
|
|
libxtst6 \
|
|
ca-certificates \
|
|
fonts-gargi \
|
|
fonts-ipafont-gothic \
|
|
fonts-kacst \
|
|
fonts-thai-tlwg \
|
|
fonts-wqy-zenhei \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
|
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
|
|
|
|
# Return to the base image non-root user after the apt install (mirrors the
|
|
# Node Dockerfile runner-web stage, which re-asserts USER node).
|
|
USER bun
|