qwen / Dockerfile
axm0121's picture
Recover per-account proxies and handle unavailable model requests safely
dab1774 verified
Raw History Blame Contribute Delete
1.58 kB
FROM oven/bun:1.3.14-alpine AS build
WORKDIR /app
RUN apk add --no-cache ca-certificates curl tar
RUN curl -fsSL https://codeload.github.com/Rfym21/Qwen2API/tar.gz/1b38a501c833a147d3ee3fc6317d1bc2a87d6482 | tar -xz --strip-components=1
RUN bun install --frozen-lockfile --production
WORKDIR /app/public
RUN bun install --frozen-lockfile && bun run --bun build
FROM oven/bun:1.3.14-alpine AS runtime
WORKDIR /app
RUN apk add --no-cache ca-certificates libstdc++ curl && mkdir -p /app/data /app/logs /app/caches
ENV NODE_ENV=production QWEN2API_RUNTIME_DIR=/app SERVICE_PORT=3000 LISTEN_ADDRESS=0.0.0.0
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/src ./src
COPY --from=build /app/public/dist ./public/dist
# Keep current upstream chat/CLI code; restore REST and normalize legacy proxy URLs.
COPY patches/redis-rest.js /app/src/utils/redis.js
COPY patches/proxy-helper-compatible.js /app/src/utils/proxy-helper.js
COPY patches/request-session-diagnostic.js /app/src/utils/request.js
COPY patches/header-profile-current.js /app/src/utils/header-profile.js
COPY patches/token-manager-v2-bounded.js /app/src/utils/token-manager.js
COPY patches/account-v2.js /app/src/utils/account.js
COPY patches/account-proxy-pool.js /app/src/utils/account-proxy-pool.js
COPY patches/models-controller.js /app/src/controllers/models.js
COPY patches/rest-preflight.cjs /app/scripts/rest-preflight.cjs
EXPOSE 3000
CMD ["sh", "-c", "bun --no-env-file scripts/rest-preflight.cjs && exec bun --no-env-file src/server.js"]