- Linktree-style homepage with photo, social links, and self-hosted services (container registry, Git server) - Registry pages rendered on demand from Harbor via a live content collection, cached in memory (60s fresh, 10min stale-while-revalidate) - Pinned registry images (PINNED_IMAGES) shown first with a star - Node standalone server with security headers; self-contained server build so the Docker image ships no node_modules - Gitea workflow building multi-arch images for Flux Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
// Production entry: Astro's standalone Node handler (static files + on-demand pages)
|
||||
// wrapped to add the security headers nginx used to set.
|
||||
process.env.ASTRO_NODE_AUTOSTART = 'disabled';
|
||||
|
||||
import http from 'node:http';
|
||||
|
||||
const { handler } = await import('./dist/server/entry.mjs');
|
||||
|
||||
const SECURITY_HEADERS = {
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
||||
'X-Frame-Options': 'DENY',
|
||||
};
|
||||
|
||||
const port = Number(process.env.PORT ?? 8080);
|
||||
const host = process.env.HOST ?? '0.0.0.0';
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
for (const [name, value] of Object.entries(SECURITY_HEADERS)) res.setHeader(name, value);
|
||||
handler(req, res);
|
||||
});
|
||||
|
||||
server.listen(port, host, () => console.log(`Listening on http://${host}:${port}`));
|
||||
|
||||
for (const signal of ['SIGINT', 'SIGTERM']) {
|
||||
process.on(signal, () => server.close(() => process.exit(0)));
|
||||
}
|
||||
Reference in New Issue
Block a user