arreglar container scraper

This commit is contained in:
Cat /dev/Nulo 2024-01-11 22:47:20 -03:00
parent 66fc8767ef
commit 78e0f3cdee
3 changed files with 13 additions and 11 deletions

View file

@ -1,5 +1,6 @@
FROM docker.io/oven/bun:1-alpine AS base FROM cgr.dev/chainguard/wolfi-base AS base
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN apk add --no-cache bun libgcc
FROM base as build FROM base as build
ENV NODE_ENV=production ENV NODE_ENV=production
@ -8,19 +9,19 @@ RUN bun install --frozen-lockfile
RUN bun build scraper/cli.ts --target=bun --outfile=/tmp/cli.build.js RUN bun build scraper/cli.ts --target=bun --outfile=/tmp/cli.build.js
# nightly porque usamos tl con `simd` activado # nightly porque usamos tl con `simd` activado
FROM ghcr.io/rust-lang/rust:nightly-bookworm-slim as rs-build FROM base as rs-build
WORKDIR /usr/src/app RUN apk add --no-cache rust build-base sqlite-dev
COPY scraper-rs/ .
RUN apt-get update && apt-get install -y libsqlite3-dev && rm -rf /var/lib/apt/lists/*
RUN cargo install --path .
FROM docker.io/oven/bun:1-slim COPY scraper-rs/ .
RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/* RUN cargo install --locked --path .
FROM base
RUN apk add --no-cache sqlite
# Scraper # Scraper
COPY --from=build /tmp/cli.build.js /bin/scraper COPY --from=build /tmp/cli.build.js /bin/scraper
COPY --from=build /usr/src/app/db-datos/drizzle /bin/drizzle COPY --from=build /usr/src/app/db-datos/drizzle /bin/drizzle
COPY --from=rs-build /usr/local/cargo/bin/scraper-rs /usr/local/bin/scraper-rs COPY --from=rs-build /root/.cargo/bin/scraper-rs /usr/local/bin/scraper-rs
ENV NODE_ENV=production ENV NODE_ENV=production
ENV DB_PATH=/db/db.db ENV DB_PATH=/db/db.db

3
scraper-rs/Cargo.lock generated
View file

@ -1366,7 +1366,8 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tl" name = "tl"
version = "0.7.7" version = "0.7.7"
source = "git+https://github.com/evertedsphere/tl?branch=patch-1#56711166588fa6c7729a08e5740dca2526436316" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5e993a1c7c32fdf90a308cec4d457f507b2573acc909bd6e7a092321664fdb3"
[[package]] [[package]]
name = "tokio" name = "tokio"

View file

@ -27,7 +27,7 @@ serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.109" serde_json = "1.0.109"
simple-error = "0.3.0" simple-error = "0.3.0"
thiserror = "1.0.56" thiserror = "1.0.56"
tl = { git = "https://github.com/evertedsphere/tl", branch = "patch-1", features = ["simd"] } tl = "0.7.7"
tokio = { version = "1.35.1", features = ["full"] } tokio = { version = "1.35.1", features = ["full"] }
tracing = "0.1" tracing = "0.1"
tracing-subscriber = "0.3" tracing-subscriber = "0.3"