# RecipesCam API — self-contained build (context = this folder). # Builder compiles TypeScript; runtime carries production deps only. FROM node:22-slim AS builder WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci COPY tsconfig.json ./ COPY src ./src RUN npm run build && npm prune --omit=dev # onnxruntime-node ships every platform's runtime, and 260MB of it is the CUDA / # TensorRT providers this container (CPU inference, no GPU) never loads. The # bindings for the other two operating systems go the same way; both Linux # architectures stay so the image can still be built for an ARM host. RUN rm -rf node_modules/onnxruntime-node/bin/napi-v6/darwin \ node_modules/onnxruntime-node/bin/napi-v6/win32 \ node_modules/onnxruntime-node/bin/napi-v6/linux/x64/libonnxruntime_providers_cuda.so \ node_modules/onnxruntime-node/bin/napi-v6/linux/x64/libonnxruntime_providers_tensorrt.so FROM node:22-slim ENV NODE_ENV=production \ PORT=3000 \ DATA_DIR=/data \ INPAINT_MODEL_PATH=/app/models/lama_fp32.onnx WORKDIR /app COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist COPY package.json ./ COPY models ./models RUN ln -sf /app/models /models EXPOSE 3000 CMD ["node", "dist/server.js"]