fix(docker): align build output structure and fix web 404 error

This commit is contained in:
yiling
2026-06-12 21:24:59 +08:00
parent 91fedf1477
commit 84aa1662be
3 changed files with 18 additions and 3 deletions
+16 -2
View File
@@ -59,15 +59,29 @@ const server = Bun.serve(
const filepath = join(import.meta.dir, url.pathname)
const file = Bun.file(filepath)
if (await file.exists()) {
return new Response(file)
try {
const stat = await file.stat()
if (stat.isFile()) {
return new Response(file)
}
} catch {
// ignore stat errors
}
}
const htmlFile = Bun.file(join(import.meta.dir, 'shumai-app.html'))
const htmlFile = Bun.file(join(import.meta.dir, 'index.html'))
if (await htmlFile.exists()) {
return new Response(htmlFile, {
headers: { 'Content-Type': 'text/html' },
})
}
const htmlFileNpm = Bun.file(join(import.meta.dir, 'shumai-app.html'))
if (await htmlFileNpm.exists()) {
return new Response(htmlFileNpm, {
headers: { 'Content-Type': 'text/html' },
})
}
}
return app.fetch(req)