1- FROM --platform=$BUILDPLATFORM node:22 -slim@sha256:80fdb3f57c815e1b638d221f30a826823467c4a56c8f6a8d7aa091cd9b1675ea AS builder
1+ FROM --platform=$BUILDPLATFORM node:24 -slim@sha256:f96cade014243001e5c18f1befaf0bf44564f7cf358287ef691114dcb04b173b AS builder
22WORKDIR /app
33
44# Copy workspace root `package.json` and `package-lock.json` files,
@@ -12,7 +12,7 @@ COPY ["./components/retrack-web-scraper", "./components/retrack-web-scraper"]
1212RUN set -x && npm test --ws
1313RUN set -x && npm run build --ws
1414
15- FROM node:22 -slim@sha256:80fdb3f57c815e1b638d221f30a826823467c4a56c8f6a8d7aa091cd9b1675ea
15+ FROM node:24 -slim@sha256:f96cade014243001e5c18f1befaf0bf44564f7cf358287ef691114dcb04b173b
1616ENV NODE_ENV=production \
1717 PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
1818 RETRACK_WEB_SCRAPER_BROWSER_CHROMIUM_EXECUTABLE_PATH=/usr/local/bin/chromium
@@ -34,14 +34,21 @@ RUN set -x && apt-get update && \
3434COPY ./dev/docker/chromium_local.conf /etc/fonts/local.conf
3535RUN set -x && fc-cache -fv
3636
37- COPY --from=builder ["/app/components/retrack-web-scraper/dist/", "./"]
38- COPY --from=builder ["/app/components/retrack-web-scraper/package.json", "/app/package-lock.json", "./"]
37+ # Preserve the workspace layout (root + leaf package.json + workspace lock
38+ # file) so `npm ci` can resolve the web-scraper's deps via its workspace entry.
39+ # Flattening these files into /app fails with npm >= 11 because the workspace
40+ # lockfile records dependencies under `packages."components/retrack-web-scraper"`,
41+ # not under the top-level `packages.""` key.
42+ COPY --from=builder ["/app/package.json", "/app/package-lock.json", "./"]
43+ COPY --from=builder ["/app/components/retrack-web-scraper/package.json", "./components/retrack-web-scraper/"]
44+ COPY --from=builder ["/app/components/retrack-web-scraper/dist/", "./components/retrack-web-scraper/"]
3945
40- # Install production dependencies, then use Playwright to install only the
41- # Chromium binary (no --with-deps). Create a stable symlink so the app can
42- # find the binary regardless of the Playwright revision number.
43- # Post-install cleanup: remove headless-shell, ffmpeg, all but en-US locale.
44- RUN set -x && npm ci --production && \
46+ # Install production dependencies for the web-scraper workspace only, then use
47+ # Playwright to install only the Chromium binary (no --with-deps). Create a
48+ # stable symlink so the app can find the binary regardless of the Playwright
49+ # revision number. Post-install cleanup: remove headless-shell, ffmpeg, all but
50+ # en-US locale.
51+ RUN set -x && npm ci --omit=dev --workspace=retrack-web-scraper --include-workspace-root=false && \
4552 npx playwright install chromium && \
4653 rm -rf /ms-playwright/chromium_headless_shell-* && \
4754 rm -rf /ms-playwright/ffmpeg-* && \
@@ -56,5 +63,5 @@ RUN set -x && npm ci --production && \
5663USER node
5764
5865ENTRYPOINT ["/usr/bin/dumb-init", "--"]
59- CMD ["node", "src/index.js"]
66+ CMD ["node", "components/retrack-web-scraper/ src/index.js"]
6067
0 commit comments