2026-04-17 02:07:29 +07:00
|
|
|
FROM node:24.14.1-trixie-slim AS builder
|
2026-02-18 00:02:15 -03:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-03-29 20:25:14 +09:00
|
|
|
RUN apt-get update \
|
2026-03-30 16:31:07 -04:00
|
|
|
&& apt-get install -y --no-install-recommends libsecret-1-0 ca-certificates \
|
2026-03-29 20:25:14 +09:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-02-18 00:02:15 -03:00
|
|
|
COPY package*.json ./
|
2026-03-01 00:48:27 +07:00
|
|
|
COPY scripts/postinstall.mjs ./scripts/postinstall.mjs
|
2026-04-18 07:19:58 +00:00
|
|
|
COPY scripts/postinstallSupport.mjs ./scripts/postinstallSupport.mjs
|
2026-03-12 10:11:50 -03:00
|
|
|
COPY scripts/native-binary-compat.mjs ./scripts/native-binary-compat.mjs
|
2026-04-18 04:15:42 -03:00
|
|
|
COPY scripts/postinstallSupport.mjs ./scripts/postinstallSupport.mjs
|
2026-02-18 00:02:15 -03:00
|
|
|
RUN if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi
|
|
|
|
|
|
|
|
|
|
COPY . ./
|
2026-03-29 20:25:14 +09:00
|
|
|
RUN mkdir -p /app/data && npm run build -- --webpack
|
2026-02-18 00:02:15 -03:00
|
|
|
|
2026-04-17 02:07:29 +07:00
|
|
|
FROM node:24.14.1-trixie-slim AS runner-base
|
2026-02-18 00:02:15 -03:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.title="omniroute" \
|
|
|
|
|
org.opencontainers.image.description="Unified AI proxy — route any LLM through one endpoint" \
|
|
|
|
|
org.opencontainers.image.url="https://omniroute.online" \
|
|
|
|
|
org.opencontainers.image.source="https://github.com/diegosouzapw/OmniRoute" \
|
|
|
|
|
org.opencontainers.image.licenses="MIT"
|
|
|
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
ENV PORT=20128
|
|
|
|
|
ENV HOSTNAME=0.0.0.0
|
2026-02-23 14:16:47 +05:30
|
|
|
ENV NODE_OPTIONS="--max-old-space-size=256"
|
2026-02-18 00:02:15 -03:00
|
|
|
|
2026-02-20 01:47:22 -03:00
|
|
|
# Data directory inside Docker — must match the volume mount in docker-compose.yml
|
|
|
|
|
ENV DATA_DIR=/app/data
|
2026-03-29 20:25:14 +09:00
|
|
|
RUN apt-get update \
|
2026-03-30 17:01:50 -04:00
|
|
|
&& apt-get install -y --no-install-recommends libsecret-1-0 ca-certificates \
|
2026-03-29 20:25:14 +09:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2026-02-18 00:02:15 -03:00
|
|
|
RUN mkdir -p /app/data
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /app/public ./public
|
|
|
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
|
|
|
COPY --from=builder /app/.next/standalone ./
|
2026-03-10 22:46:17 +07:00
|
|
|
# Explicitly copy @swc/helpers — not always traced by standalone output but needed at runtime
|
|
|
|
|
COPY --from=builder /app/node_modules/@swc/helpers ./node_modules/@swc/helpers
|
2026-03-18 15:08:57 -03:00
|
|
|
# Explicitly copy pino transport dependencies — pino spawns a worker that requires
|
|
|
|
|
# pino-abstract-transport at runtime; Next.js standalone trace does not capture it (#449)
|
|
|
|
|
COPY --from=builder /app/node_modules/pino-abstract-transport ./node_modules/pino-abstract-transport
|
|
|
|
|
COPY --from=builder /app/node_modules/pino-pretty ./node_modules/pino-pretty
|
2026-03-19 01:46:26 -03:00
|
|
|
COPY --from=builder /app/node_modules/split2 ./node_modules/split2
|
2026-02-26 15:11:40 +00:00
|
|
|
COPY --from=builder /app/scripts/run-standalone.mjs ./run-standalone.mjs
|
2026-02-26 15:43:02 +00:00
|
|
|
COPY --from=builder /app/scripts/runtime-env.mjs ./runtime-env.mjs
|
2026-03-10 21:55:21 +00:00
|
|
|
COPY --from=builder /app/scripts/bootstrap-env.mjs ./bootstrap-env.mjs
|
2026-02-27 16:29:58 -03:00
|
|
|
COPY --from=builder /app/scripts/healthcheck.mjs ./healthcheck.mjs
|
2026-02-18 00:02:15 -03:00
|
|
|
|
|
|
|
|
EXPOSE 20128
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
2026-02-27 16:29:58 -03:00
|
|
|
CMD ["node", "healthcheck.mjs"]
|
2026-02-18 00:02:15 -03:00
|
|
|
|
2026-02-26 15:11:40 +00:00
|
|
|
CMD ["node", "run-standalone.mjs"]
|
2026-02-18 00:02:15 -03:00
|
|
|
|
|
|
|
|
FROM runner-base AS runner-cli
|
|
|
|
|
|
|
|
|
|
# Install system dependencies required by openclaw (git+ssh references).
|
|
|
|
|
RUN apt-get update \
|
2026-03-29 20:25:14 +09:00
|
|
|
&& apt-get install -y --no-install-recommends git ca-certificates docker.io docker-compose \
|
2026-02-18 00:02:15 -03:00
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
&& git config --system url."https://github.com/".insteadOf "ssh://git@github.com/"
|
|
|
|
|
|
|
|
|
|
# Install CLI tools globally. Separate layer from apt for better cache reuse.
|
|
|
|
|
RUN npm install -g --no-audit --no-fund @openai/codex @anthropic-ai/claude-code droid openclaw@latest
|