fix: embed takumi into compiled binary
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
README.md
|
||||
.vscode/
|
||||
note_modules/
|
||||
node_modules/
|
||||
Dockerfile
|
||||
compose.yml
|
||||
.dockerignore
|
||||
|
||||
@@ -40,3 +40,5 @@ yarn-error.log*
|
||||
**/*.log
|
||||
package-lock.json
|
||||
**/*.bun
|
||||
|
||||
dist
|
||||
+2
-2
@@ -11,8 +11,8 @@ RUN bun run build
|
||||
FROM oven/bun:alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/server /app/
|
||||
COPY --from=builder /app/dist/* /app/
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["./server"]
|
||||
CMD ["./src"]
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { basename } from "node:path";
|
||||
import { build, file, Glob, write } from "bun";
|
||||
|
||||
const nativeFiles = new Glob("**/*.node");
|
||||
console.log(
|
||||
"Native files:",
|
||||
Object.fromEntries(
|
||||
await Promise.all(
|
||||
[...nativeFiles.scanSync()].map(async (f) => [
|
||||
`src/${basename(f)}`,
|
||||
file(f).size,
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
build({
|
||||
compile: true,
|
||||
minify: true,
|
||||
target: "bun",
|
||||
entrypoints: ["src/index.ts"],
|
||||
outdir: "dist",
|
||||
features: ["FAKE_REQUIRE"],
|
||||
});
|
||||
|
||||
for (const f of nativeFiles.scanSync()) {
|
||||
await write(`dist/${basename(f)}`, file(f));
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "bun run --watch src/index.ts",
|
||||
"build": "bun build --compile --minify-whitespace --minify-syntax --target bun --outfile server src/index.ts"
|
||||
"build": "bun build.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elysiajs/openapi": "^1.4.14",
|
||||
|
||||
Reference in New Issue
Block a user