74f487486f
- server.js: catch browser-launch failures inside the injected fetchAndExtractPriceViaBrowser wrapper so they route through checkProduct's normal error classification (recordCheckFailure) instead of escaping as a thrown error that bypasses the DB write. - server.js: add an in-flight guard around runCheck so overlapping callers (cron + check-now) share one run instead of each launching its own Chromium. - Dockerfile: copy only package.json/package-lock.json/node_modules before installing Chromium so the expensive install layer is keyed to dependency changes, not every commit; copy the rest of the app afterward. - Dockerfile: clean up apt package lists after the Playwright install step, matching the build stage's existing cleanup. - README.md: note that exercising the fallback locally (not just running the test suite) needs `npx playwright install chromium`. - README.md: correct the fallback description — domcontentloaded navigation reads the page before most client-side JS finishes, so the fallback mainly helps with HTTP-client blocking, not JS-rendered prices; reworded to drop the inaccurate claim. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013gwc3aCiyQxmCWQke8RvEz
24 lines
797 B
Docker
24 lines
797 B
Docker
FROM node:22-slim AS build
|
|
RUN apt-get update && apt-get install -y --no-install-recommends python3 build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev
|
|
COPY . .
|
|
|
|
FROM node:22-slim
|
|
WORKDIR /app
|
|
COPY --from=build /app/package.json /app/package-lock.json ./
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
RUN npx --yes playwright install --with-deps chromium \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /app .
|
|
ENV NODE_ENV=production
|
|
# De SQLite-database hoort op het persistente volume te staan; zonder deze
|
|
# default zou een vergeten DB_PATH stilletjes naar de container-fs schrijven
|
|
# en bij elke redeploy alle data verliezen.
|
|
ENV DB_PATH=/data/korting.db
|
|
VOLUME /data
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|