fix static file serving path for docker deployment
This commit is contained in:
@@ -168,10 +168,12 @@ export async function createServer() {
|
||||
}, { prefix: "/api/v1" });
|
||||
|
||||
// serve static frontend build in production
|
||||
const webDist = resolve(process.cwd(), "../web/dist");
|
||||
if (process.env.NODE_ENV === "production" && existsSync(webDist)) {
|
||||
const webDist = resolve(process.cwd(), "packages/web/dist");
|
||||
const webDistAlt = resolve(process.cwd(), "../web/dist");
|
||||
const staticRoot = existsSync(webDist) ? webDist : existsSync(webDistAlt) ? webDistAlt : null;
|
||||
if (process.env.NODE_ENV === "production" && staticRoot) {
|
||||
await app.register(fastifyStatic, {
|
||||
root: webDist,
|
||||
root: staticRoot,
|
||||
wildcard: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user