mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 22:26:19 +00:00
dockerfile.scraper: agregar DB con migraciones
This commit is contained in:
parent
244dddf6d4
commit
7e09c65012
1 changed files with 10 additions and 1 deletions
|
@ -2,14 +2,23 @@ FROM cgr.dev/chainguard/wolfi-base AS base
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
RUN apk add --no-cache libgcc
|
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
|
FROM base as rs-build
|
||||||
RUN apk add --no-cache rust build-base sqlite-dev
|
RUN apk add --no-cache rust build-base sqlite-dev
|
||||||
|
|
||||||
COPY scraper-rs/ .
|
COPY scraper-rs/ .
|
||||||
|
COPY --from=db-build /usr/src/app/db.db .
|
||||||
RUN --mount=type=cache,sharing=locked,target=/root/.cargo/git \
|
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=/root/.cargo/registry \
|
||||||
--mount=type=cache,sharing=locked,target=/usr/src/app/target \
|
--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
|
FROM base
|
||||||
RUN apk add --no-cache sqlite sqlite-libs
|
RUN apk add --no-cache sqlite sqlite-libs
|
||||||
|
|
Loading…
Reference in a new issue