More work on fixing Docker build

This commit is contained in:
Jesse Wierzbinski 2024-04-06 22:56:15 -10:00
parent 015177e3a2
commit ea1d7b1510
No known key found for this signature in database
9 changed files with 163 additions and 145 deletions

View file

@ -1,4 +1,5 @@
// Delete dist directory
import { $ } from "bun";
import { cp, exists, mkdir, rm } from "node:fs/promises";
import { rawRoutes } from "~routes";
@ -13,7 +14,6 @@ await rm("./dist", { recursive: true });
await mkdir(`${process.cwd()}/dist`);
//bun build --entrypoints ./index.ts ./prisma.ts ./cli.ts --outdir dist --target bun --splitting --minify --external bullmq,@prisma/client
await Bun.build({
entrypoints: [
`${process.cwd()}/index.ts`,
@ -25,7 +25,7 @@ await Bun.build({
outdir: `${process.cwd()}/dist`,
target: "bun",
splitting: true,
minify: true,
minify: false,
external: ["bullmq"],
}).then((output) => {
if (!output.success) {
@ -33,6 +33,10 @@ await Bun.build({
}
});
// Fix for wrong Bun file resolution, replaces node_modules with ./node_modules inside all dynamic imports
// I apologize for this
await $`sed -i 's|import("node_modules/|import("./node_modules/|g' dist/*.js`;
// Create pages directory
// mkdir ./dist/pages
await mkdir(`${process.cwd()}/dist/pages`);