- Registry/constants: drop qmodel_preview/gm51model, add lite, qmodel_38max (Qwen3.8-Max), qfmodel (Qwen3.8-Flash), gmodel (GLM-5.3), gfmodel (GLM-5.3-Flash) - capabilities: add PROVIDER_CAPABILITIES['qoder'] so opaque internal ids resolve to their real models' context windows and limits - executor: preserve image blocks instead of flattening away, convert Claude-style image blocks, and hash images into chat_record_id - tests: cover image preservation, data-URI and Claude-block conversion - build(docker): use CN mirrors for apk and npm
60 lines
2.2 KiB
Docker
60 lines
2.2 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
ARG NODE_IMAGE=node:22-alpine
|
|
FROM ${NODE_IMAGE} AS base
|
|
WORKDIR /app
|
|
# CN mirror for apk (used by builder and runner stages)
|
|
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories
|
|
|
|
FROM base AS builder
|
|
|
|
RUN apk --no-cache upgrade && apk --no-cache add python3 make g++ linux-headers
|
|
|
|
COPY package.json ./
|
|
RUN npm install --registry=https://registry.npmmirror.com
|
|
|
|
COPY . ./
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npm run build
|
|
|
|
FROM ${NODE_IMAGE} AS runner
|
|
WORKDIR /app
|
|
|
|
LABEL org.opencontainers.image.title="9router"
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=20128
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV DATA_DIR=/app/data
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/custom-server.js ./custom-server.js
|
|
COPY --from=builder /app/open-sse ./open-sse
|
|
# Next file tracing can omit sibling files; MITM runs server.js as a separate process.
|
|
COPY --from=builder /app/src/mitm ./src/mitm
|
|
# Standalone node_modules may omit deps only required by the MITM child process.
|
|
COPY --from=builder /app/node_modules/node-forge ./node_modules/node-forge
|
|
# Ensure `next` is available at runtime in case tracing did not include it.
|
|
COPY --from=builder /app/node_modules/next ./node_modules/next
|
|
# sql.js loads dist/sql-wasm.wasm by path at runtime; tracing only follows JS imports,
|
|
# so the last-resort DB driver would abort with ENOENT on the missing binary.
|
|
COPY --from=builder /app/node_modules/sql.js ./node_modules/sql.js
|
|
# node-machine-id is createRequire-loaded at runtime; tracing omits it.
|
|
COPY --from=builder /app/node_modules/node-machine-id ./node_modules/node-machine-id
|
|
|
|
RUN mkdir -p /app/data && chown -R node:node /app && \
|
|
mkdir -p /app/data-home && chown node:node /app/data-home && \
|
|
ln -sf /app/data-home /root/.9router 2>/dev/null || true
|
|
|
|
# Fix permissions at runtime (handles mounted volumes)
|
|
RUN apk --no-cache upgrade && apk --no-cache add su-exec && \
|
|
printf '#!/bin/sh\nchown -R node:node /app/data /app/data-home 2>/dev/null\nexec su-exec node "$@"\n' > /entrypoint.sh && \
|
|
chmod +x /entrypoint.sh
|
|
|
|
EXPOSE 20128
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["node", "custom-server.js"]
|