This commit is contained in:
Rizky 2024-01-21 18:32:28 +07:00
parent 202f4f62ce
commit 62c32af9be
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
FROM oven/bun:1.0.18-debian as base FROM oven/bun:1.0.18-debian as base
WORKDIR /app/docker WORKDIR /app/prasi/repo
COPY docker.ts docker.ts COPY . .
RUN apt-get update RUN apt-get update
RUN apt-get install git curl gnupg zip unzip -yq RUN apt-get install git curl gnupg zip unzip -yq
@ -11,7 +11,9 @@ RUN apt-get update
RUN apt-get install nodejs -yq RUN apt-get install nodejs -yq
RUN npm i -g @parcel/watcher node-gyp-build-optional-packages node-gyp RUN npm i -g @parcel/watcher node-gyp-build-optional-packages node-gyp
RUN bun install
RUN bun build
EXPOSE 3000/tcp EXPOSE 4550/tcp
CMD [ "bun", "run", "docker.ts" ] CMD [ "bun", "run", "prod" ]

View File

@ -1,6 +1,6 @@
import { $ } from "execa";
import { existsAsync } from "fs-jetpack"; import { existsAsync } from "fs-jetpack";
import { dir } from "./dir"; import { dir } from "./dir";
import { $ } from "execa";
import { g } from "./global"; import { g } from "./global";
export const preparePrisma = async () => { export const preparePrisma = async () => {
@ -8,6 +8,10 @@ export const preparePrisma = async () => {
(await existsAsync(dir.path("app/db/.env"))) || (await existsAsync(dir.path("app/db/.env"))) ||
process.env.DATABASE_URL process.env.DATABASE_URL
) { ) {
g.log.info("Prisma: db pull & generate");
await $({ cwd: dir.path(`app/db`) })`bun prisma db pull`;
await $({ cwd: dir.path(`app/db`) })`bun prisma generate`;
const { PrismaClient } = await import("../../../app/db/db"); const { PrismaClient } = await import("../../../app/db/db");
g.db = new PrismaClient(); g.db = new PrismaClient();
} }