From 33d416d921f66442131aee68cbfd1a49761ff426 Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 30 Jan 2024 11:06:35 -0300 Subject: [PATCH] dockerfile.scraper: agregar DB con migraciones --- Dockerfile.scraper | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile.scraper b/Dockerfile.scraper index 8494c5f..6a06df3 100644 --- a/Dockerfile.scraper +++ b/Dockerfile.scraper @@ -2,14 +2,23 @@ FROM cgr.dev/chainguard/wolfi-base AS base WORKDIR /usr/src/app RUN apk add --no-cache libgcc +# tenemos que generar una DB con las migraciones aplicadas para compilar el codigo por sqlx::query!() +FROM base as db-build +RUN apk add --no-cache nodejs npm +RUN npm install --global pnpm +COPY db-datos/ . +RUN pnpm install +RUN DB_PATH=db.db pnpm migrate + FROM base as rs-build RUN apk add --no-cache rust build-base sqlite-dev COPY scraper-rs/ . +COPY --from=db-build /usr/src/app/db.db . RUN --mount=type=cache,sharing=locked,target=/root/.cargo/git \ --mount=type=cache,sharing=locked,target=/root/.cargo/registry \ --mount=type=cache,sharing=locked,target=/usr/src/app/target \ - cargo install --locked --path . + DATABASE_URL=sqlite:db.db cargo install --locked --path . FROM base RUN apk add --no-cache sqlite sqlite-libs