fix: embed takumi into compiled binary

This commit is contained in:
2026-03-13 09:02:10 +07:00 Unverified
parent 3a0a5cf097
commit 649466a4de
5 changed files with 35 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
README.md README.md
.vscode/ .vscode/
note_modules/ node_modules/
Dockerfile Dockerfile
compose.yml compose.yml
.dockerignore .dockerignore
+3 -1
View File
@@ -39,4 +39,6 @@ yarn-error.log*
**/*.tgz **/*.tgz
**/*.log **/*.log
package-lock.json package-lock.json
**/*.bun **/*.bun
dist
+2 -2
View File
@@ -11,8 +11,8 @@ RUN bun run build
FROM oven/bun:alpine AS runner FROM oven/bun:alpine AS runner
WORKDIR /app WORKDIR /app
COPY --from=builder /app/server /app/ COPY --from=builder /app/dist/* /app/
EXPOSE 3000 EXPOSE 3000
CMD ["./server"] CMD ["./src"]
+28
View File
@@ -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
View File
@@ -4,7 +4,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"dev": "bun run --watch src/index.ts", "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": { "dependencies": {
"@elysiajs/openapi": "^1.4.14", "@elysiajs/openapi": "^1.4.14",