- Add browser-scraper.ts using Puppeteer for JS-heavy stores - Add render_js flag to store model, migration, YAML sync, and UI - Scraper engine auto-selects cheerio vs Puppeteer based on flag - Store forms include JS rendering toggle in Advanced section - Create first store config: HG Spot (Croatian electronics retailer) - Update Dockerfile with Chromium for production Puppeteer support Tested: HG Spot returns 15 products per page with correct names, prices (EUR), links, and images using headless browser rendering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
950 B
Docker
43 lines
950 B
Docker
# Stage 1: Build client
|
|
FROM node:20-alpine AS client-build
|
|
WORKDIR /app/src/client
|
|
COPY src/client/package*.json ./
|
|
RUN npm ci
|
|
COPY src/client/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Build server
|
|
FROM node:20-alpine AS server-build
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY tsconfig.json ./
|
|
COPY src/server/ ./src/server/
|
|
RUN npx tsc
|
|
|
|
# Stage 3: Production runtime
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
|
|
# Install Chromium for Puppeteer
|
|
RUN apk add --no-cache chromium
|
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
COPY --from=server-build /app/dist ./dist
|
|
COPY --from=client-build /app/src/client/build ./dist/client
|
|
COPY src/server/db/migrations ./dist/server/db/migrations
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV DATABASE_PATH=/app/data/pricehunter.db
|
|
ENV STORES_DIR=/app/stores
|
|
|
|
EXPOSE 3000
|
|
VOLUME /app/data
|
|
|
|
CMD ["node", "dist/server/index.js"]
|