File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM oven/bun AS setup
22WORKDIR /bun-dir
33COPY . .
4- RUN bun build ./src/server-node.js --target node --outdir ./dist --entry-naming bun.mjs --format esm
5- RUN export BLOCKLIST_DOWNLOAD_ONLY=true && node ./dist/bun.mjs
4+ RUN bun install
5+ # flybun --packages=external to ask bun to not resolve @riaskov/mmap-io (which brings in mapbox among other deps)
6+ RUN npm run build:flybun
7+ RUN export BLOCKLIST_DOWNLOAD_ONLY=true && bun run ./dist/bun.mjs --smol
68
79FROM oven/bun:alpine AS runner
810# env vals persist even at run-time: archive.is/QpXp2
@@ -12,7 +14,8 @@ WORKDIR /app
1214COPY --from=setup /bun-dir/dist ./
1315COPY --from=setup /bun-dir/blocklists__ ./blocklists__
1416COPY --from=setup /bun-dir/dbip__ ./dbip__
17+ # @riaskov/mmap-io native is unused in bun as it has built-in mmap support
1518# print files in work dir, must contain blocklists
1619RUN ls -Fla
1720# run with the default entrypoint (usually, bash or sh)
18- CMD ["bun" , "run" , "./bun.mjs" ]
21+ CMD ["bun" , "run" , "./bun.mjs" , "--smol" ]
Original file line number Diff line number Diff line change 1515 "build" : " npx webpack --config webpack.config.cjs" ,
1616 "build:fastly" : " npx webpack --config webpack.fastly.cjs && npm run fastly:wasm" ,
1717 "build:fly" : " npx webpack --config webpack.fly.cjs" ,
18+ "build:flybun" : " bun build ./src/server-node.js --production --target node --outdir ./dist --entry-naming bun.mjs --format esm --packages=external" ,
1819 "fastly:wasm" : " npx js-compute-runtime ./dist/fastly.js ./dist/fastly.wasm"
1920 },
2021 "repository" : {
Original file line number Diff line number Diff line change 101101if [ $runtime = " bun" ] || [ $runtime = " b" ]; then
102102 echo " note: bun v1+ required" ;
103103 echo " using ` which bun` " ;
104- start=" bun run src/server-node.js" ;
104+ start=" bun run src/server-node.js --smol " ;
105105elif [ $runtime = " deno" ] || [ $runtime = " d" ]; then
106106 echo " note: deno v2+ required" ;
107107 echo " using ` which deno` " ;
You can’t perform that action at this time.
0 commit comments