diff options
| author | yyamashita <yyamashita@mosquit.one> | 2026-05-08 00:06:36 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@mosquit.one> | 2026-05-08 00:06:36 +0900 |
| commit | 8f64dcc0e4e389903e6a7198d0a2b11498fcd948 (patch) | |
| tree | 645ea500111b383d5bd180a000b397414238d594 /Dockerfile | |
| parent | 529b4038b38cecab6601ed5bed2d340834358f45 (diff) | |
Add scraper service to docker-compose with 6-hourly cron
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -9,7 +9,7 @@ COPY --from=deps /app/node_modules /app/node_modules WORKDIR /app RUN npm run build -FROM node:20-slim +FROM node:20-slim AS app WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci --omit=dev @@ -18,3 +18,18 @@ RUN npx playwright install chromium --with-deps RUN mkdir -p /app/data EXPOSE 3000 CMD ["npm", "start"] + +FROM node:20-slim AS scraper +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci --omit=dev && npm install tsx +COPY --from=build /app/build ./build +COPY scripts ./scripts +COPY app ./app +COPY tsconfig.json ./ +RUN npx playwright install chromium --with-deps +RUN apt-get update && apt-get install -y cron && rm -rf /var/lib/apt/lists/* +RUN echo '0 */6 * * * root cd /app && DB_PATH=/app/data/events.db node --import tsx/esm scripts/scrape.ts >> /app/data/scraper.log 2>&1' > /etc/cron.d/scraper \ + && chmod 0644 /etc/cron.d/scraper +RUN mkdir -p /app/data +CMD ["cron", "-f"] |
