Restructure compute core by extracting job contracts and runtime logic into separate modules (`contracts.ts`, `local-runtime.ts`) for improved modularity and clearer API boundaries. Update exports and imports across worker, server, and local compute backends to use the new modules. Enhance Next.js config to support dynamic backend selection via build-time constants and aliasing, enabling seamless switching between local and worker compute modes. Adjust TypeScript paths and Dockerfile entrypoint to align with the new structure.
29 lines
678 B
Docker
29 lines
678 B
Docker
FROM node:lts AS deploy-stage
|
|
|
|
RUN npm install -g pnpm@11.1.2
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
COPY compute/worker/package.json compute/worker/package.json
|
|
COPY compute/core/package.json compute/core/package.json
|
|
|
|
COPY compute/worker compute/worker
|
|
COPY compute/core compute/core
|
|
|
|
RUN pnpm --config.inject-workspace-packages=true --filter @openreader/compute-worker deploy /opt/compute-worker
|
|
|
|
FROM node:lts
|
|
|
|
RUN npm install -g pnpm@11.1.2
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY --from=deploy-stage /opt/compute-worker ./
|
|
|
|
ENV COMPUTE_WORKER_HOST=0.0.0.0
|
|
ENV COMPUTE_WORKER_PORT=8081
|
|
|
|
EXPOSE 8081
|
|
|
|
CMD ["node", "--import", "tsx", "src/server.ts"]
|