Add esbuild production bundle and multi-stage slim Docker image.
Bundle server (and mcp entry) into a single JS file with deps inlined, minify UI into one HTML, and ship only dist/ in the runtime image.
This commit is contained in:
11
src/index.js
11
src/index.js
@@ -1,3 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const express = require('express');
|
||||
const { WebshareClient } = require('./webshare');
|
||||
const { caps, feed } = require('./torznab');
|
||||
@@ -113,8 +115,13 @@ app.get('/resolve/:ident', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// ── UI static files ────────────────────────────────────────────────────────
|
||||
app.use(express.static('ui'));
|
||||
// ── UI static files (dev: ../ui from src/; production: dist/ui next to server.js)
|
||||
const uiRoot =
|
||||
process.env.UI_DIR ||
|
||||
(fs.existsSync(path.join(__dirname, 'ui'))
|
||||
? path.join(__dirname, 'ui')
|
||||
: path.join(__dirname, '..', 'ui'));
|
||||
app.use(express.static(uiRoot));
|
||||
|
||||
// ── UI API: JSON search ───────────────────────────────────────────────────
|
||||
app.get('/api/search', async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user