Compare commits

..

No commits in common. "448341d4e99eebc88efd4d3863a576d440b17476" and "43954d7af8d90755f393f426e75a507f4135c1d0" have entirely different histories.

6 changed files with 42 additions and 8 deletions

View file

@ -11,4 +11,3 @@ Dockerfile
*.warc.zst
.git
scraper/debug/
*/target/

View file

@ -25,6 +25,34 @@ jobs:
- run: bun check
working-directory: ./scraper
build-and-push-scraper:
runs-on: ubuntu-latest
needs: check
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/scraper
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: scraper/Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-sitio:
needs: check
runs-on: ubuntu-latest
@ -49,6 +77,7 @@ jobs:
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: sitio/Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -10,8 +10,8 @@ RUN cd sitio && \
bun run build
RUN bun build scraper/cli.ts --target=bun --outfile=/tmp/cli.build.js
FROM cgr.dev/chainguard/wolfi-base
RUN apk add --no-cache nodejs npm jq bun
FROM base
RUN apk add --no-cache tini nodejs npm jq
# Sitio
COPY --from=build /usr/src/app/sitio/package.json package.real.json
@ -27,4 +27,5 @@ ENV NODE_ENV=production
ENV DB_PATH=/db/db.db
EXPOSE 3000
ENTRYPOINT ["tini", "--"]
CMD ["node", "."]

BIN
bun.lockb

Binary file not shown.

View file

@ -38,7 +38,7 @@
"better-sqlite3": "^9.2.2",
"chart.js": "^4.4.1",
"chartjs-adapter-dayjs-4": "^1.0.4",
"croner": "^8.0.0",
"cron": "^3.1.6",
"dayjs": "^1.11.10",
"drizzle-orm": "^0.29.1"
}

View file

@ -1,9 +1,14 @@
import { spawn } from "child_process";
import Cron from "croner";
import { CronJob } from "cron";
if (process.env.NODE_ENV === "production") {
const job = Cron("15 3 * * *", () => {
const job = CronJob.from({
cronTime: "0 3 * * *",
onTick: function () {
runScraper();
},
start: true,
timeZone: "America/Argentina/Buenos_Aires",
});
}